This is my model
class Business(models.Model):
address = models.ForeignKey(Address)
website = models.URLField(blank=True)
name = models.CharField(max_length=64)
mail_address = models.ForeignKey(Address,related_name="mailing_address")
my address model
class Address(models.Model):
address_line1 = models.CharField("Address line 1", max_length = 45)
address_line2 = models.CharField("Address line 2", max_length = 45, blank = True)
city = models.CharField(max_length = 50, blank = False)
state = USStateField()
postal_code = USZipCodeField()
im trying to write a view where the user enters the business and address info at the same time
i am trying to use a model formset for users to fill in business and mailing addresses
however I want to make it such that the user can leave the mailing address section blank if it is the same as business address.
how do i achieve this since in my address model nothing can be left blank…
further if a user wants to edit it how do i render the formset with different instances?
later you can check whether there is a mailing adress or not and use it appropiately.