I have been trying to figure this out for two days now with no luck. I
am wanting the add/change view in the Admin app to display an inline
form for the same model twice. Right now I cannot do that. Can
somebody point me in the right direction?
This is a legacy database I am working with, not one created by
Django. The models point directly to tables, so an abstract base class
is probably not going to work here. I have a model similar to the
following...
class Address(models.Model):
id = models.IntegerField(primary_key=True)
line1 = models.CharField(max_length=36)
line2 = models.CharField(max_length=36)
city = models.CharField(max_length=36)
state = models.CharField(max_length=2)
postal = models.DecimalField(max_digits=9, decimal_places=-4)
class Member(models.Model):
id = models.IntegerField(primary_key=True)
dob = models.DateField()
mailing_address = models.ForeignKey(Address,
related_name="mailing_address")
home_address = models.ForeignKey(Address,
related_name="home_address")
I want the Member views to have two inline forms for the Address model
-- one for mailing_address, and another for home_address. I have tried
several things, here is a short list...
Django had me add the related_name parameter to the Member model
because of clashes. I suppose those are suppose to point to database
columns in the address table, but I am not sure, is that correct? At
first I commented out the home_address, removed the related_name param
from mailing_address and tried to setup an inline form. Django
complained about there being no ForeignKey in Address back to Member.
I tried setting up an intermediate linker table for both address types
and using a ManyToMany field. That gave me a model to the intermediate
table, not the Address table.
I have tried various other arcane things to try and make this work
with no success. It seems something like this should be fairly
straight forward. Any pointers would be a huge help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---