There's a way to do what you want to do, but I don't remember out of
the top of my head. I can check it out on the week, but you'll need to
customize some things on the Producer's ModelAdmin, not just set the
list of inlines, because, as it was said, inlines are for "children"
objects (i.e. other
Have you tried using unique_together? You could add unique_together = (
('type', 'producer',), ) to your Address model. There really isn't any way for
the default admin to edit a second table at the same time.
https://docs.djangoproject.com/en/1.4/ref/models/options/#unique-together
On Feb
Thanks, but I've omitted related_name and I've used distinct related_names and
gotten the same errors. I don't want to reuse addresses. The one-to-one
relationship you describe is precisely what I'm trying to do.
On Feb 14, 2013, at 1:32 AM, Jani Tiainen wrote:
> Hi,
>
>
Hi,
You're trying to setup one-to-one relationship.
It means that producer.mailing_address does have exactly one unique
Address entity. Same goes for physical_address.
What you want is really ForeignKey to address which means that you reuse
addresses to multiple producer.mailing_address.
I've considered the address-type-and-foreign-key approach you describe —
and implemented it and then backed it out again — but that approach bugs me
at a philosophical level. Address is then bound explicitly to Producer and
instead of having two addresses each with a specific designation I can
Inlines are for related objects, meaning when I have a foreign key from A
to B, on A there is an actual database field that points to B, but on B
there's a virtual (related object) field implemented as a python method.
When you have a foreign key, the way the admin shows that is just to give
you a
You might try specifying distinct related names, just off the cuff. -Bill
On Wed, Feb 13, 2013 at 2:25 PM, Ray Hatfield wrote:
> Hi,
>
> I have a model which requires two addresses: a mailing address and a
> physical address. From an OO perspective it makes sense to have
Hi,
I have a model which requires two addresses: a mailing address and a
physical address. From an OO perspective it makes sense to have an Address
class and the Producer to have Address instances as properties, but I can't
seem to achieve this in django while still being able to edit the
8 matches
Mail list logo