I have the following 2 tables
In models.py
class Foo(models.Model):
uuid = models.CharField(_('UUID'), primary_key=True, default=uuid4)
and
class FooExt(models.Model):
uuid = models.ForeignKey(Foo, verbose_name=_('UUID'), primary_key=True)
time = models.DateTimeField(_('Create DateTime'), auto_now_add=True)
Basically, I have Foo
and FooExt
. I want a one-to-one relation between FooExt
. That's why I set FooExt
's primary key to be foreign key into Foo
(not sure if this is the right thing to do).
Now I add an entry into Foo
. Does an entry for FooExt
automatically get created? Or do I need to manually add an entry to both Foo
and FooExt
?
Is there anything I can do to get the "automatic" add feature? Conceptually, these 2 tables describe the same thing, but I just don't want to pollute Foo
with extra information. So it'd be great if an add to Foo
automatically creates a corresponding FooExt
.