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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:12:29+00:00 2026-06-05T02:12:29+00:00

Here is my code. I passed over some parts. class Members(db.Model): author = db.UserProperty()

  • 0

Here is my code. I passed over some parts.

class Members(db.Model):
    author = db.UserProperty()
    username = db.StringProperty()

class Events(db.Model):
    author = db.ReferenceProperty(Members)

class MainPage(webapp.RequestHandler):
    def get(self):
        user = users.get_current_user()
        if user:
            member = Members()
            member.author = user
            member.username = ''
            member.put()

class AddEvent(webapp.RequestHandler):
    def post(self):
        event = Events()
        event.author = Members(author=users.get_current_user())
        event.put()
        self.redirect('/add')
    def get(self):
        path = os.path.join(os.path.dirname(__file__), 'templates', 'add_event.html')
        self.response.out.write(template.render(path, None))

When adding a new event, I got this error BadValueError: Members instance must have a complete key before it can be stored as a reference. I do some search and this error occured when we don’t save entity instance (put()). So I added the code to save the user to the datastore but I got the same error. And when I put the code to save the user in AddEvent class, it works.

  • 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-05T02:12:32+00:00Added an answer on June 5, 2026 at 2:12 am

    I think you want to change your post() to something like this (not tested):

    def post(self):
        member = Members.all().filter("author =", users.get_current_user()).get()
        event = Events()
        event.author = member
        event.put()
        self.redirect('/add')
    

    You don’t want to create a new Members entity, you want to retrieve the one you’ve already created.

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

Sidebar

Related Questions

Here's the code: //check if the starting row variable was passed in the URL
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
Here is code example class A{ int i; public: A(int i) : i(i) {}
I'm trying to port some PHP code over to C#, and I ran across
I really need some help here, we are trying to use our player over
Ok the error is showing up somewhere in this here code if($error==false) { $query
Here is code from MSDN . I don't understand why the work isn't just
here is code for regular expression matching #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int
enter code here I have a table on SQL server 2005 with bigint primary
The code here is X++. I know very little about it, though 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.