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

The Archive Base Latest Questions

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

I have a django app with several form that I am trying to migrate

  • 0

I have a django app with several form that I am trying to migrate to ajax. I am doing this because I want to update my data without refreshing my screen. I used the dajax library and started moving some of my views.py code into ajax.py.

I am getting a “ValueError: too many values to unpack ” in code that worked fine in views.py. I’m not sure why this is happening or how to fix it. Advice?

ajax.py

def send_student_form(request, form):
  dajax = Dajax()
  #error is here
  student = Student.objects.get( form.get('student_id'))
  #student = Student()  # no ValueError, but it doesn't find my student.
  if student:
    print "Student Found!"
    sForm = StudentProfileForm(request.POST, instance=student) 
    print student
  else:
    print "Student Not Found"
    sForm = StudentProfileForm(request.POST)
    #TODO: new Student
  • 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-18T22:42:33+00:00Added an answer on May 18, 2026 at 10:42 pm

    You need to define which field you are querying, for example:

    # Query by primary key
    student = Student.objects.get(pk = form.get('student_id'))
    

    Using non-keyword syntax is also allowed, but ugly. Non-keywords arguments are a special case in Django’s query building process, see constructor of the Q class if you want to know more.

    student = Student.objects.get(("pk", form.get('student_id')))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django app that gets it's data completely from an external source
I have a Django app that use a django-tagging. I need to port this
This is probably a setting error somewhere. I have a django app that works
I have a Django app that needs to pull the follower_count information from several
Other posters have previously said in this forum that when your Django app starts
I have written a Django app that makes use of Python threading to create
I have a Django app that uses MySQL as a backend. I'm having difficulties
I have a django app that has / at the end of every URL
I have a Django app with custom form fields, some of which have slow
I have a Django app with a model that contains a field of type

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.