#16320: Please have view support for databases
----------------------------------+---------------------------------
 Reporter:  benedict.m.holland@…  |          Owner:  nobody
     Type:  New feature           |         Status:  new
Milestone:                        |      Component:  ORM aggregation
  Version:  1.3                   |       Severity:  Normal
 Keywords:                        |   Triage Stage:  Unreviewed
Has patch:  0                     |  Easy pickings:  0
    UI/UX:  0                     |
----------------------------------+---------------------------------
 I am linking django to a legacy app database with views. The views have
 primary keys associated with them and can not be synced using the
 ./managed.py syncdb if and when I need to recreate this db on my test
 environment. I can create the views with manual sql code but when I run
 the syncdb command the view doesn't exist and it throws and error saying
 that the foreign key to this view can not be created because the table
 doesn't exist.

 I think the solution is a signal which is sent directly after the model is
 saved to the database which would allow me to hook off of it to create the
 views. Currently the REALLY nasty hack I am doing is creating my own view,
 subclassing off an unmanaged model which is the view, and after the syncdb
 running custom sql to create the view. I have to foreign key off of the
 actual table (not the view) which means that none of the associated view
 columns are available with that object when I do foreign object
 referencing in code like: foo.object = object where foo.object is a
 foreign key. The only work around is to alter every single reference to
 foo.object to foo.object = View.objects.get() which is prohibitively
 expensive and could in fact break a lot of stuff.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16320>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to