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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:57:59+00:00 2026-06-13T18:57:59+00:00

For my first Django project I’m trying to make an app that lets users

  • 0

For my first Django project I’m trying to make an app that lets users create lists of media (books, movies, etc.) with various fields describing each object (title, author, etc.), and I’m having trouble figuring out how to get it to save. That is to say that nothing happens when the form is submitted. Can someone tell me what I’m doing wrong? Sorry if this is a bit of a noob question; it seems like I’m missing something really basic here. (I’m using basic HTML forms instead of ModelForms because for some media types I want to ignore certain fields – e.g. “author” for movies – but if there is an easy way to do that using ModelForms, I’m all ears.)

from views.py:

def editbook(request,list_owner,pk):
    book_list = Item.objects.all().filter(item_creator=list_owner).filter(category='book').order_by('type','name')  
    item_to_edit = Item.objects.get(pk=pk)
    if request.method == 'POST':
        item_to_edit.save()
        return render_to_response('books.html', {'booklist': book_list, 'listowner': list_owner}, RequestContext(request))
    else:
        form=EditItem()
        return render_to_response('editbook.html', {'listowner': list_owner, 'item_to_edit': item_to_edit}, RequestContext(request))

from models.py:

CATEGORY_CHOICES = (
    ('book','book'),
    ('tv','tv'),
    ('movie','movie'),
    ('game','game'),
    ('music','music'),
)

class Item(models.Model):
    item_creator = models.CharField(max_length=30) # user name goes here
    category = models.CharField(max_length=5, choices=CATEGORY_CHOICES)
    name = models.CharField(max_length=70)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)  
    artist = models.CharField(max_length=70, blank=True)
    type = models.CharField(max_length=50, blank=True)
    progress = models.CharField(max_length=10, blank=True)
    finished = models.BooleanField(default=False)
    rating = models.IntegerField(default=0, blank=True, null=True)
    comment = models.CharField(max_length=140, blank=True)
    def __unicode__(self):
        return self.name
  • 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-13T18:58:01+00:00Added an answer on June 13, 2026 at 6:58 pm

    There is, of course, a way to only use some fields in a modelform: as fully documented in Using a subset of fields on the form, you can use the fields or exclude attributes in the form’s Meta class.

    However you’ll still need, as szaman points out, to pass the POST data to the form and check for validity, and in addition you’ll need to pass in the instance paramater as you’re updating an existing instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a database in my first Django project (called meu_blog). I've
I moved my first Django project from DjangoEurope to Webfaction, and that started an
I am trying to debug my Django project via Eclipse. The app works fine
I'm starting on my first large django project and have realized that the default
I am trying to add a custom field to my Django project that uses
First django app and am having a bit of trouble my project is laid
I am trying to build my first Django project from scratch and am having
I am trying to set up my first project in Django in the most
I have setup a Django project on my laptop and build my first app.
I am trying to create my 1st project in django using jython. I am

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.