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 8839853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:19:50+00:00 2026-06-14T10:19:50+00:00

I have the following models: class Model1(models.Model): field1 = … field2 = … class

  • 0

I have the following models:

class Model1(models.Model):
     field1 = ...
     field2 = ...
     class Meta:
          abstract = True

class Model2(models.Model):
     field3 = ...
     field4 = ...
     class Meta:
          abstract = True

I have concrete implementations of the above:

class ConcreteModel1(Model1):
     field1_group = ... # foreign key to ConcreteModel3


class ConcreteModel2(Model2):
     field3_test = ... # foreign key to ConcreteModel4

I have abstract ModelForms:

 class Model1Form(ModelForm):
         class Meta:
          widgets = { ... }
          abstract = True

 class Model2Form(ModelForm):
         class Meta:
          widgets = { ... }
          abstract = True

I have concrete ModelForms:

 class ConcreteModel1Form(Model1Form):
         class Meta(Model1Form.Meta):
             model = ConcreteModel1
             exclude = ('field1_group')


 class ConcreteModel2Form(Model2Form):
         class Meta(Model2Form.Meta):
             model = ConcreteModel2
             exclude = ('field3_test')

Now as you can see there are parallels between the two model forms.
The problem is that in my template field1 is visible for ConcreteModel1Form (expected behavior)
But in another template field3 is not visible for ConcreteModel2Form (unexpected behavior).

If I comment out exclude=(‘field3_test’) then field3 is visible in the template (expected behavior) but form validation fails since field3_test is None and is a required field.

What am I missing? This seems to be a problem with my code that i can’t figure out. This behavior is clearly inconsistent and I am not able to see the difference in my code.

Any ideas how to debug this? What could be the problem?

I tried removing abstract=True from the base form class, does not help.

Explicitly specifying the field list in the ConcreteModelForm classes works though. But I don’t see why exclude list works on one case but not the other.

  • 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-06-14T10:19:51+00:00Added an answer on June 14, 2026 at 10:19 am

    Could you try adding a trailing comma in your exclude field list. Let us know the result.

    exclude = ('field1_group', )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following models: class ProjectUser(models.Model): categories = models.ManyToManyField('UserCategory', blank=True, null=True) user_id =
I have the following models: class Foo(models.Model): field1 = models.IntegerField() ... class Bar(models.Model): field1
I have models similar to the following: class Band(models.Model): name = models.CharField(unique=True) class Event(models.Model):
I have the following models: class Product(models.Model): active = models.BooleanField(default=True) name = models.CharField(max_length=40, unique=True)
Hi I have the following models class Student(models.Model): student_id = models.CharField(max_length=3, unique=True) first_name =
I have the following two models class ModelOne(models.Model): mod_desc = models.CharField(max_length=25) is_active = models.BooleanField(default=True)
I have the following models class Person(models.Model): name = models.CharField(max_length=100) class Employee(Person): job =
I have the following models: class City(models.Model): name = models.CharField(max_length=100) class Pizza(models.Model): name =
I have the following models: class Profile(models.Model): verified = models.BooleanField(default=False) primary_phone = models.OneToOneField('Phone', related_name='is_primary',
Suppose I have the following models: class User(models.Model): pass class A(models.Model): user = models.ForeignKey(User)

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.