#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 honeyman):
Replying to [comment:21 wolfram]:
> 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!
Not quite so. I do something close to this:
models.py:
{{{
from db_model1 import model1
from db_model2 import model2
}}}
db_model2.py:
{{{
from django.db import models
from db_myview1 import myview1
class MyView1(models.Model):
class Meta:
sql_generation_required = False # by my patch
fkey = models.ForeignKey(myview1, db_column = 'id') # This is why I need
"import myview1" at the top
# other fields, presented by the SQL view
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/3163#comment:22>
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
-~----------~----~----~----~------~----~------~--~---