Friday, May 27, 2016

Re: Model inheritance with constraints

Its already addressed.

You can simply run ./manage.py makemigrations and ./manage.py migrate

it will create migrations only for MyAnotherFunModel





On Thursday, 26 May 2016 01:02:08 UTC+5:30, Arnab Banerji wrote:
Hi all,

I currently have a set of models associated with my Django app, with the database already containing data with respect to these tables (models). 

What I have
=========

class MyFunModel(models.Model):
    my_foo_field = <blah>

What I am attempting to add
=====================

class MyAnotherFunModel(MyFunModel):
    my_another_foo_field = <blah>

Such that the migration gives me *only* <app>_myanotherfunmodel table with fields "my_foo_field" and "my_another_foo_field", *without* touching any data in the <app>_myfunmodel table. 

None of the options in https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance seem to address this case, or maybe I am missing something?

Thanks,
AB

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fbc77543-ee22-4b61-a295-b5f1870b1648%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment