I want to have a django model like this:
class Model(models.Model):
string = models.CharField()
class ContactDetails:
phone = models.IntegerField()
Is this possible? I’ve tried googling but it doesn’t seem to answer my question
This would mean i’d have while accesssing:
Model().ContactDetails.phone
working like that 🙂
Joe
It can have embedded classes (a common case is
class Meta), but anymodels.*Fieldmembers are ignored. It doesn’t make sense in SQL.What you want is a many-to-one:
Then, to access:
or whatever.