0

I have already created a set of tables with Postgresql, I would like, to make a query directly from tables to Django views without writing any models to pose as a form?

asked Mar 21, 2017 at 17:24

1 Answer 1

3

You can use the inspectdb management command to automatically generate models from an existing database:

python manage.py inspectdb > models.py

For more information, see the official docs: https://docs.djangoproject.com/en/1.10/howto/legacy-databases/

answered Mar 21, 2017 at 17:39
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you, and apologize as can't up-vote due to my low reputations.
Hello J.McBride, this will only creating the models out of tables where they came with django! is there anyway to point to desired - created database or Schema?
Thank you I found answer for my problem! amvtek.com/blog/posts/2014/Jun/13/…

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.