Django querysets and postgresql views

44 views
Skip to first unread message

Cherrymae Tulfo

unread,
Mar 17, 2014, 9:32:25 PM3/17/14
to django...@googlegroups.com
can Django query data from a postgresql view?
I have trouble intersecting querysets in Django. .
so i'm thinking, can Django retrieve data from a postgresql view?

esatte...@wi.rr.com

unread,
Mar 18, 2014, 9:10:04 AM3/18/14
to django...@googlegroups.com
Yes you can. Just create the view however you like. Make a django model with the fields that map to the table the view returns and set the model to managed = false.

You can only fetch data and do simple filtering obviously.

m1chael

unread,
Mar 18, 2014, 9:14:55 AM3/18/14
to django...@googlegroups.com
esatterwhite, that's a great tip! What about raw queries as another option?
> --
> 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...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2b59ab10-3c98-495c-ae3c-00aad9a59f54%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Cherrymae Tulfo

unread,
Mar 19, 2014, 1:35:43 AM3/19/14
to django...@googlegroups.com
if Postgresql view is made within Postgresql, i mean by not making in django models, would still Django access these data?
Reply all
Reply to author
Forward
0 new messages