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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:10:45+00:00 2026-05-26T10:10:45+00:00

I have started learning django and have a problem with INSERT-query using ORM (DB

  • 0

I have started learning django and have a problem with INSERT-query using ORM (DB mysql).
My model:

class Record(models.Model):
    id         = models.AutoField(primary_key=True, blank=True),
    schema_id  = models.IntegerField(),
    name       = models.CharField(max_length=50),
    desc       = models.TextField(blank=True)

    class Meta:
        db_table = 'keeper_record'

Following code is handle post query in view.py:

def add_record(request):
    if request.method == 'POST':
        Record.objects.create(
            schema_id  = request.POST.get('schema_id', 1),
            name       = request.POST.get('name', 'd'),
            desc       = request.POST.get('desc', ' ')
        )

        record.save()

    return HttpResponse('')

But this code raising error:

Request Method: POST
Request URL:    http://127.0.0.1:8000/records/add/
Django Version: 1.3.1
Exception Type: TypeError
Exception Value:    
'schema_id' is an invalid keyword argument for this function
Exception Location: C:\Program Files (x86)\Python\lib\site-packages\django\db\models\base.py in __init__, line 364
Python Executable:  C:\Program Files (x86)\Python\python.exe
Python Version: 2.7.2
Python Path:    
['D:\\Projects\\passkeeper',
 'D:\\\xcf\xf0\xee\xe3\xf0\xe0\xec\xec\xfb\\\xcf\xf0\xee\xe3\xf0\xe0\xec\xec\xe8\xf0\xee\xe2\xe0\xed\xe8\xe5\\PyCharm\\helpers',
 'D:\\Projects\\passkeeper',
 'D:\\Projects',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Program Files (x86)\\Python\\DLLs',
 'C:\\Program Files (x86)\\Python\\lib',
 'C:\\Program Files (x86)\\Python\\lib\\plat-win',
 'C:\\Program Files (x86)\\Python\\lib\\lib-tk',
 'C:\\Program Files (x86)\\Python',
 'C:\\Program Files (x86)\\Python\\lib\\site-packages']

I install mysql driver for python and have standard settings for project, but only was removed csrf

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    #'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
)
  • 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-26T10:10:45+00:00Added an answer on May 26, 2026 at 10:10 am

    My guess is these commas in your model definition.

    You are setting schema_id to a tuple of a model field. id = (models.AutoField(...),)

    Remove the trailing comma and you should be good to go.

    class Record(models.Model):
        id         = models.AutoField(primary_key=True, blank=True), # remove ,
        schema_id  = models.IntegerField(), # remove ,
        name       = models.CharField(max_length=50), # remove ,
        desc       = models.TextField(blank=True)
    
        class Meta:
            db_table = 'keeper_record'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently started learning/using django; I'm trying to figure out a way to have
Okay so I have started a new language in class. We are learning Scheme
I have started learning Python by writing a small application using Python 3.1 and
I have started learning WCF. I wrote a simple service to query a SQL
I started learning Django recently and am having a strange problem with the tutorial.
I have just started learning rails, tho i have a bit problem. I know
I have started learning cakePHP and now I am facing the following problem. How
I'm an impulsive coder by nature and have started learning the virtue of patience
I have just started learning Erlang and am trying out some Project Euler problems
I have recently started learning F#, and this is the first time I've ever

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.