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

  • SEARCH
  • Home
  • 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 3423214
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:19:42+00:00 2026-05-18T06:19:42+00:00

I have a form that handles m2m request in the validation. my form looks

  • 0

I have a form that handles m2m request in the validation.

my form looks as follows

class HuntingReportForm(ModelForm):
    date_travel_started = forms.DateField(widget=extras.SelectDateWidget(years=range(1970,2010)))
    date_travel_ended = forms.DateField(widget=extras.SelectDateWidget(years=range(1970,2010)))
    wish_list = forms.ModelMultipleChoiceField(queryset=Specie.objects.all(), widget=FilteredSelectMultiple("verbose name", is_stacked=False), required=False)
    bag_list = forms.ModelMultipleChoiceField(queryset=Trophies.objects.all(), widget=FilteredSelectMultiple("verbose name", is_stacked=False), required=False)

class Meta:
    model = HuntingReport
    exclude = ['user',]

def __init__(self, user, *args, **kwargs):
    self.validate = kwargs.pop('validate',False)
    super(HuntingReportForm, self).__init__(*args, **kwargs)

    users = User.objects.filter(userprofile__outfitter=True)
    self.fields['outfitter'].choices = [('', '')] + [(user.pk, user.get_full_name()) for user in users]
    self.fields.keyOrder = ['title', 'report', 'date_travel_started', 'date_travel_ended', 'wish_list', 'bag_list', 'outfitter']

When I remove the whole def __init__ section the forms seems to validate and save, however with the following code it just keep throwing me back to the page saying that some fields weren’t filled in, even when they were.

Any ideas?

  • 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-18T06:19:43+00:00Added an answer on May 18, 2026 at 6:19 am

    You don’t show the view, but presumably you’re instantiating the form with the usual form = HuntingReportForm(request.POST). Unfortunately, you’ve changed the signature of the form’s __init__ method to expect user as the first positional argument, so the data isn’t being passed in. You should move user to kwargs and treat it the same as your validate argument:

    def __init__(self,*args, **kwargs):
        user = kwargs.pop('user', None)
        self.validate = kwargs.pop('validate', False)
        super(HuntingReportForm, self).__init__(*args, **kwargs)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that looks kind of like this: <div> <div class=contact> <h1>Person's
I have an Action method in an ASP.NET MVC Controller class that handles form
I have a form that handles editing of a domain model (A). This domain
Let's say I have a multithreaded C++ program that handles requests in the form
I have a form that handles 2 models, Vehiculo and Poliza. This is how
I have a form that handles four different types of facets of the same
I have a working django form that submits and the django view handles the
I have a php script that handles a form input. For design reasons both
I currently have form that checks if a user has unsubmitted changes when they
We have a form that hosts the WebBrowser control. That is the only control

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.