Syncing db with existing tables through django for an existing schema table and also updating few columns for the tables and the rest automatically -


i doing poc in django , trying create admin console module inserting,updating , deleting records through django admin console through models , doing fine have 2 questions.

1.i need have model objects existing tables needs present in particular schema.say schema1.table1 here of doing poc public schema. can done in fixed defined schema , if yes how.any reference helpful

2.also wanted update few columns in table through console , rest of columns done automatically currentimestamp , created date etc.is possible through default django console , if yes kindly share reference

steps 1

what have done of created class in model.py attributes author,title,body,timeofpost

then used sqlmigrate after makemigrations app create table , after migrating have been using admin console django insert , update records table created.but poc only.

now need same existing tables whom can interact , insert or update record existing tables through admin console.

also tables getting created in public schema default.but using postgres , existing tables present in different schemas , wanted insert,update , delete existing tables.

i stuck here dont know how configure model existing database schema tables through can interact through django console , different schemas , not in public schema

steps 2:

also wanted user give input few columns suppose in case time of creation not required given input user .rather should taken care when database updating or creating

thanks

in order django "interact" existing database need create model can done automatically as shown here. assumes "external" database isn't going changed because you'll have keep models in sync tricky - there other approaches if need that.

as working multiple database schemas - there reason can't put poc table in same database others? django supports multiple databases, harder setup. see here.

finally, sounds interested in setting django default field attribute. example of current time see here.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -