Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6077099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:40:58+00:00 2026-05-23T10:40:58+00:00

This is my model class Business(models.Model): address = models.ForeignKey(Address) website = models.URLField(blank=True) name =

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:40:58+00:00Added an answer on May 23, 2026 at 10:40 am
    1. remove the mail_adress Foreign Key in the Buisness Model
    2. add a normal CharField for the mailing list
    3. dont make this charfield required.

    later you can check whether there is a mailing adress or not and use it appropiately.

    If mailing_adress:
        do stuff
    else:
        use buisness.address
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my model: class Position(models.Model): map = models.ForeignKey(Map,primary_key=True) #members=models.CharField(max_length=200) LatLng = models.CharField(max_length=40000) infowindow
I have the following models: class Product(models.Model): active = models.BooleanField(default=True) name = models.CharField(max_length=40, unique=True)
This is my model class Business(models.Model): business_type = models.ManyToManyField(BusinessType) establishment_type = models.ForeignKey(EstablishmentType) website =
I have a Model that looks something like this: class Business(models.Model): name = models.CharField('business
I have this model in django: class JournalsGeneral(models.Model): jid = models.AutoField(primary_key=True) code = models.CharField(Code,
I have a model class like this: class Note(models.Model): author = models.ForeignKey(User, related_name='notes') content
Suppose my model is this: class Ego(models.Model): event = models.ForeignKey(Event) user = models.ForeignKey(User) As
This is just an example, but given the following model: class Foo(models.model): bar =
I have a rather generic model, as follows: class Keyword(models.Model): ancestors = models.ManyToManyField(Keyword) name
This is my model; namespace AtAClick.Models { public class LocalBusiness { public int ID

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.