﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
16320	Please have view support for databases	benedict.m.holland@…	nobody	"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. "	New feature	closed	Database layer (models, ORM)	1.3	Normal	invalid			Design decision needed	0	0	0	0	0	0
