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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:46:05+00:00 2026-06-10T20:46:05+00:00

I have a model with many fields, for which I am creating two partial

  • 0

I have a model with many fields, for which I am creating two partial forms

#model
class Line_Settings(models.Model):
....
    line = models.ForeignKey(Line)
    All = models.BooleanField(default=False)
    Busy = models.BooleanField(default=False)
    MOH = models.CharField(max_length=100, blank=True, null=True)
    PLAR = models.CharField(max_length=100, blank=True, null=True)
....

    def save(self, commit = True, *args, **kwargs):
       ....
#Partial model form1
class General(ModelForm):
    class Meta:
        model = Line_Settings
        fields = ('MOH','PLAR')
#Partial model form2        
class Common(ModelForm):
    class Meta:
        model = Line_Settings
        fields = ('All','Busy') 

I have overwritten the save for the Line_Settings model to do additional logic.

I need to be able to pass some parameters to the overwritten save method to use in my logic.

In my views I fill up the two partials forms with post data and can call save.

call_forwards = Common(request.POST, instance=line_settings)
general = General(request.POST, instance=line_settings)

I need to pass a parameter to the save like so:

call_forwards.save(parameter="value")
general.save(parameter="value")

I have referred to passing an argument to a custom save() method

I can get access to the parameter if I overwrite the save on my partial form.

# overwritten save of partial form
def save(self, parameter, commit=True):
     print("In save overwrite Partial form Common "+str(parameter))
     #how Can I pass this parameter to the model save overwirite?
     super(Common, self).save(commit)

From the partial form, how do I make the parameter reach my original model(Line_Settings) save overwrite?

Can this be done?
Thanks in advance for reading!!

  • 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-10T20:46:07+00:00Added an answer on June 10, 2026 at 8:46 pm

    I was able to achieve this by defining a parameter in my original models __init__ method

    def __init__(self, *args, **kwargs):
        self.parameter= None
        super(Line_Settings, self).__init__(*args, **kwargs)
    

    Then in the partial form, I could access this parameter and set it to value passed during save

     def save(self, *args, **kwargs):
         self.instance.parameter = kwargs.pop('parameter', None)
         super(Common, self).save(*args, **kwargs)
    

    In my view I called the save as :

    common = Common(request.POST, instance=line_settings)
    common.save(parameter="something")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following model class Plugin(models.Model): name = models.CharField(max_length=50) # more fields which
I have Django Model with many fields which user must fill. If I'll create
I have a class that has a number of fields, two of which are
I have a model with many fields (nearly 40). The client wants the fields
I have a model Task which will HABTM many TaskTargets. When it comes to
I have an Entry model which has many Tag s. Tag s are added
I am creating the model for a web application. The tables have ID fields
I have question model which has many options. In my question controller new action
I have two models called 'Page' and 'Area' There relationships are as follows: class
I have a Django model which can have many generic relationships. This is achieved

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.