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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:17:11+00:00 2026-06-06T10:17:11+00:00

What is the most straightforward way to edit some fields from a batch of

  • 0

What is the most straightforward way to edit some fields from a batch of objects using a formset (see below), while displaying along other fields from these models objects?

For example:

I want to display the title of a set of 10 Book objects and a form for each one in which it is possible to edit their ISBN and description.

class BookForm(ModelForm):
    class Meta:
        model = Book
        fields = ('ISBN', 'description')   # The Book model has many more fields

BookFormSet = modelformset_factory(Book, form=BookForm)
  • 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-06T10:17:13+00:00Added an answer on June 6, 2026 at 10:17 am

    According to the doc: a model form instance bound to a model object will contain a self.instance attribute that gives model form methods access to that specific model instance. Thus when you have a formset of Model such as BookFormSet

    BookFormSet = modelformset_factory(Book, form=BookForm)
    formset = BookFormSet(request.POST, queryset=Book.objects.order_by('-pk')[:10])
    

    You could iterate it in template like:

    <ul>{% for f in formset %}
        <li>{% if f.instance.pk %}title: {{ f.instance.title }}{% endif %} {{ f }}</li>
    {% endfor %}</ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In PHP, what is the most straightforward way to convert a RGB triplet to
I'm looking for the simplest, most straightforward way to implement the following: main starts
Possible Duplicate: What is the most straightforward way to pad empty dates in sql
If I build a site using Wordpress, is there a straightforward way to restrict
What is the most straightforward way to create a hash table (or associative array...)
I want to pass some data around threads but want to refrain from using
I'm looking for the simplest, most straightforward way to implement the following: The main
What is the most straightforward mechanism by which to link_to_remote and popout a window
Most databases support some form of insert into select... statement. insert into a select
I'm looking for the most Rails-y way to create a table that displays data

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.