>> I have a lot of models for classifications. All of
them have similar
>> attributes. When I try to use inheritance in the
models design, the
>> admin interface doesn't work with ForeignKey
fields.
>>
>> Example:
>>
>> class BasicModel(models.Model):
>> name=models.CharField(maxlength=30)
>> def __str__(self):
>> return self.name
>>
>> class Reference(BasicModel):
>> class Admin:
>> pass
>>
>> class Data(BasicModel):
>> ref = models.ForeingKey(Reference)
>> class Admin:
>> pass
>>
>> Here, the ref field doesn't show all of their
records in the Admin Add
>> Data form.
>
> You will likely run into all kinds of problems. Model
Inheritance is
> currently not supported in Django. There has been
discussions and
> proposals on the topic so I suspect that it will be
available at some
> point. See here:
>
> h
ttp://code.djangoproject.com/wiki/ModelInheritance
Also you may try to use multiple inheritance, which has
worked for me for
extending models, i.e.
class YourModel(YourOtherModel,models.Model):
Not sure if it will work for your purpose, but give it a
try!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|