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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:27:48+00:00 2026-06-04T08:27:48+00:00

my template looks like: <form method=post action=> {{ formset.management_form }} {% for form in

  • 0

my template looks like:

<form method="post" action="">
  {{ formset.management_form }}
  {% for form in formset.forms %}
    {{ form.contractor }} {{ form.date }} {{ form.value }} {{ form.comment }} {{ form.operation_type }} {{ form.category }} {{ form.account }}
  {% endfor %}
</form>

but the result allows to change all of fields – but i want only one.

I thought that (please notice “.value” after all but category field) solves the problem, but not.

<form method="post" action="">
  {{ formset.management_form }}
  {% for form in formset.forms %}
    {{ form.contractor.value }} {{ form.date.value }} {{ form.value.value }} {{ form.comment.value }} {{   form.operation_type.value }} {{ form.category }} {{ form.account.value }}
  {% endfor %}
</form>

UPD:
relevant view code

def detail(request, category_id):
  from django.forms.models import modelformset_factory
  OperationFormSet = modelformset_factory(Operation)
  if request.method == "POST":
    formset = OperationFormSet(request.POST, request.FILES,
                                queryset=Operation.objects.filter(category=category_id))
    if formset.is_valid():
      formset.save()
      # Do something.
  else:
    formset = OperationFormSet(queryset=Operation.objects.filter(category=category_id))
  return render_to_response("reports/operation_list.html", {
    "formset": formset,
  })
  • 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-04T08:27:50+00:00Added an answer on June 4, 2026 at 8:27 am

    Your problem is that the readonly values are NOT passed back to the server, and thus your formset should fail as it’s only receiving one field.

    You’d want to show the value AND set a hidden field to store the data the formset is expecting. But I’d recommend a different approach…

    Ultimately, a formset and form is used to display html forms and not built for anything else. You’d have to hack it to show hidden widgets, make sure users can’t POST arbitrary data, etc. So instead, I would use the forms framework to only display your one editable field.

    Create a ModelForm that only has one editable field

    class MyModelForm(forms.ModelForm):
        class Meta:
            model = Operation
            fields = ('category',)
    
    MyModelFormSet = modelformset_factory(Operation, form=MyModelForm)
    

    As for displaying values in the template, ModelForms should have their instance directly accessible via form.instance so you should be able to do something like this:

    {% for form in formset %}
       {{ form.instance.some_attribute }}
       {{ form.category }} 
    {% endfor %}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a template: ... <form action=/reportform/ method=post> <p><label>Aircraft system:</label> <br>{{ Querry.system }} ...
I have created form inside a template file. Form code looks like: <div id=form
I have this: <form action='/ltsp' method='GET'> <label>Download Option:</label> <select name=''> <option name='download' value='download'>download</option> <option
I'm making a form for user registration. Here's what my template looks like: <h1>Register</h1>
I have template that looks like this: 100 template<size_t A0, size_t A1, size_t A2,
It looks like this template tag works like a charm for most people: http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/
My object looks like: public class Template { public string Title {get;set;} public string
I have code that looks like this: template<class T> class list { public: class
Suppose I have a function which looks like this: template <class In, class In2>
I want to have a template class that looks something like what I have

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.