Thursday, March 26, 2020

Re: CRUD Operations Without Model

Hey, whatever your name is,

There is a command called inspectdb in Django (python manage.py inspectdb). Basically it reads database tables configuration and creates a models script.

which can be copied into models.py then use it. And make sure that they are in models class meta for these tables are set to managed = False.

if managed set to false then Django will not modify database tables. But there is a catch, You have to manually update model if you change any table configuration from database side like form pgadmin4.


Thanks and Regards,
Naveen

On Thursday, 26 March 2020 18:18:23 UTC+5:30, LiquidOxygen SpiritsGenuine wrote:
Hello All..

I am using PostgreSQL as my database. I already have the tables created.
I just want to use DJango/Python APIs to perform CRUD operations without re-creating the tables again using Model. 

Please help.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d7ba2640-24ec-432c-b11e-a2a57d6c9256%40googlegroups.com.

No comments:

Post a Comment