Perhaps take the site down (or clone it), set managed = True, ask manage.py for sql for that app, and put everything back?
On Tue, Apr 2, 2013 at 3:46 PM, Serdar Dalgic <s...@serdardalgic.org> wrote: > Hi; > > In my project, we are using django 1.3.2, and we're on the verge of > migrating to 1.4. > I wrote a standalone app, in which I've created some models with > > class Meta: > managed = False > > setting in every model class. (The reason why I did like this is, I > prefer to use a different DB than the default one for mapping those > models.) > Now, I want to create the tables on my **app_db_name** DB, so I use the > command > > python manage.py sqlall appname --database=app_db_name > > However this manage.py sql(all) commands checks for the models and if > they are set to be managed by the users, this command gives no > outputs. > > So, I've hacked into the code a little, and found that > **django.db.backends.creation** module's **sql_create_model()** > function has such a check: > > def sql_create_model(self, model, style, known_models=set()): > """ > Returns the SQL required to create a single model, as a tuple of: > (list_of_sql, pending_references_dict) > """ > .... > if not opts.managed or opts.proxy: > return [], {} > .... > > So I solved my problem by commenting out this if clause. > > What I want to ask is, is there a better way of seeing my managed > models' sql create statements? > I'd prefer to have an option like "--show-managed" to "python > manage.py sql" or sqlall commands, so that this can me done. > > What are your comments on this issue? > > Thanks. > > -- > - Serdar Dalgıç <s...@serdardalgic.org> > FLOSS Developer, Life & Nature Hacker > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.