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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:35:26+00:00 2026-06-16T14:35:26+00:00

I get the following error message when I try to submit a new entity

  • 0

I get the following error message when I try to submit a new entity in GAE.

File "C:\Users\Chris\Documents\Web Apps\legalstudybuddy\main.py", line 179, in post
    c = Courses(user=user, title=title)
TypeError: __init__() got an unexpected keyword argument 'user'

Here is my Python code:

class Courses(db.Model):
    user = db.StringProperty(required = True)
    title = db.StringProperty(required = True)
    created = db.DateTimeProperty(auto_now_add = True)

class Courses(Handler):
    def get(self, courses="", title="", signup_username="", login_logout=""):

        if not self.user:
            self.redirect('/login')

        user = str(self.read_secure_cookie('user_id'))
        courses = db.GqlQuery('SELECT * from Courses  WHERE user = :user ORDER BY created DESC', user=user)

        signup_username, login_logout = self.user_check()

        self.render('courses.html', courses=courses,
                    title=title,
                    signup_username=signup_username,
                    login_logout=login_logout)

    def post(self):
        if not self.user:
            self.redirect('/login')

        user = str(self.read_secure_cookie('user_id'))
        title = self.request.get('title')

        if title:
            c = Courses(user=user, title=title)
            c.put()

        self.redirect('/courses')

The unexpected keyword argument is from creating the entity not from the django template. Any help would be much appreciated.

  • 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-16T14:35:27+00:00Added an answer on June 16, 2026 at 2:35 pm

    You’re defining Courses twice. Once as the model:

    class Courses(db.Model):
        user = db.StringProperty(required = True)
        title = db.StringProperty(required = True)
        created = db.DateTimeProperty(auto_now_add = True)
    

    But also as the handler:

    class Courses(Handler):
        # code
    

    Since you define the handler second, that is what is stored as Courses in the current namespace. For example:

    In [1]: class Courses(object):
       ...:     a = 'First Courses'
       ...:     
       ...:     
    
    In [2]: class Courses(object):
       ...:     a = 'Second Courses'
       ...:     
       ...:     
    
    In [3]: Courses.a
    Out[3]: 'Second Courses'
    

    I would suggest changing the name of the handler so that you don’t get the conflict you are getting now (where when you call Courses(user=user), it is trying to call the handler instead of the model).

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

Sidebar

Related Questions

I get following error message, when I try to run git rebase -i for
I get the following error message when I try the following: Dim XL As
I get the following error message when I try this query: $query .= ($tid,
I get the following error message when I try to go to my rails
Does anybody know why I get the following error message when I try to
I get the following error message when I try to INSERT some data: SQLSTATE[23000]:
I get the following error message when i try to run some php code
I get the following error message when I try to compile a solution that
I get the following error message when I try to start the Git GUI:
When I try do install rmagick I get the following error message: Can't install

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.