How to handle database VIEWS in Django

31 views
Skip to first unread message

django_learner

unread,
Oct 11, 2018, 1:38:00 AM10/11/18
to Django users
Hi everyone,

I am using SQL SERVER and I have some predefines VIEWS in the database, what I am looking for is to manage that VIEWS


Thank you

Gurmeet Kaur

unread,
Oct 11, 2018, 7:50:26 AM10/11/18
to django...@googlegroups.com
Just code for them in models.py just as a table. And it will work. 

I have done that in my project. It is working fine. 

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/27c14f60-b074-4b79-a1db-d9b519ac6637%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andréas Kühne

unread,
Oct 11, 2018, 9:45:16 AM10/11/18
to django...@googlegroups.com
It works perfectly by coding them as a model in the same way you always do. The only thing you have to do is make sure that you set the table name and that migrations shouldn't be handled for the view:

class Meta:
managed = False
db_table = 'events_sessionparticipant'

Regards,

Andréas


Reply all
Reply to author
Forward
0 new messages