#3163: [patch] Optionally disable DB table creation from model
------------------------------------------+---------------------------------
Reporter: [EMAIL PROTECTED] | Owner: nobody
Status: reopened | Component: Database
wrapper
Version: SVN | Resolution:
Keywords: raw SQL view | Stage: Design
decision needed
Has_patch: 1 | Needs_docs: 0
Needs_tests: 1 | Needs_better_patch: 0
------------------------------------------+---------------------------------
Comment (by wolfram):
Replying to [comment:20 honeyman]:
> Replying to [comment:19 wolfram]:
> > Can you please explain what you mean here? Especially by "but
restricts in importing the views from models"!
> > Actually using dbviews would never generate a table in the DB, so
there is no need for removing it. Create the views by using the sqlcustom
files.
>
> If I do "from db_myview1 import myview1" from another model (imported
from models.py) rather than from dbviews.py, it still will be imported and
used in sql generation (i.e. imported from models.py transitively). And in
my case, it would be good to do such import from another imported model,
to use it for foreign key from the other model. I didn't try to legally
use the view as a foreign key on SQL level (and I doubt it'll work), but
it works like a charm in Django and it is pretty convenient :)
> Though I agree, if someone does not need to refer to the view on the
model class declaration, "dbviews" approach should work.
If I understand you right you are doing the following inside models.py
{{{
from db_myview1 import myview1
}}}
if thats the case, remove it form there.
You must not do it in the models,py but only in the place where you need
teh db-views.
So for example inside app/core/views.py you can do the import, but not
inside the models.py!
Wolfram
--
Ticket URL: <http://code.djangoproject.com/ticket/3163#comment:21>
Django Code <http://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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---