Wednesday, May 25, 2016

Model inheritance with constraints

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/4f897668-3400-4d28-9c67-5d303ddd27e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment