Hi all,

I have 2 models that look something like this:

class Address(models.Model):
    address_row1 = models.CharField(max_length=200, null=True, blank=True)
    address_row2 = models.CharField(max_length=200, null=True, blank=True)
    postal_code = models.CharField(max_length=30, null=True, blank=True)
    city = models.CharField(max_length=80, null=True, blank=True)
    state = models.ForeignKey(USState, null=True, blank=True)
    country = models.CharField(max_length=2, null=True, blank=True,
choices=regional.COUNTRY_CODES)

class Customer(AbstractUser):
    company = models.CharField('company', max_length=100, null=True,
blank=True)
    phone = models.CharField('phone', max_length=80, null=True, blank=True)
    cellphone = models.CharField('cell phone', max_length=80, null=True,
blank=True)

    newsletter = models.BooleanField('newsletter', default=True)

    billing_address_same_as_shipping = models.BooleanField(default=True)
    shipping_address = models.ForeignKey(Address, null=True, blank=True,
related_name="shipping_address")
    billing_address = models.ForeignKey(Address, null=True, blank=True,
related_name="billing_address")

So the Customer model has 2 foreignkeys to the Address model. What I would
like to do in django admin is have the ability to add address models to the
customer model. This is of course the way it is from the beginning, however
I don't want a dropdown list to choose the address from, I want to be able
to edit the address model inline, and add one inline if it doesn't exist.
How would I be able to do that with the admin interface?

I don't want to have to create an Address object and then choose it from
the dropdown list. What I want to be able to do is edit the Address object
directly in the Customer object if the Address object exists and then be
able to add one if it doesn't.

Regards,

Andréas

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALXYUbkOyLRUpV7xKeH%2BjPfkqxakLCKY%3Dfg_E4EEcTmy%3DovP4A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to