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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:02:04+00:00 2026-05-18T01:02:04+00:00

I have a model Image that has a propery named uploaded_by_user that is a

  • 0

I have a model Image that has a propery named “uploaded_by_user” that is a db.ReferenceProperty for the User model. When I query for the image in the “uploaded by user” property I already have the user value as a model.. I don’t want that, I just want the key. I don’t want that extra query to load the user. Is that possible?

EDIT1:

the array of images then is sent over PYAMF to flex. So the items must contain all data necessary.

EDIT2

Error:

    Traceback (most recent call last):
    ,  File "D:\Totty\webDevelopment\TottysWorld\src\pyamf\remoting\amf0.py", line 108, in __call__
        *args, **kwargs)
    ,  File "D:\Totty\webDevelopment\TottysWorld\src\pyamf\remoting\amf0.py", line 61, in _getBody
        **kwargs)
    ,  File "D:\Totty\webDevelopment\TottysWorld\src\pyamf\remoting\gateway\__init__.py", line 510, in callServiceRequest
        return service_request(*args)
    ,  File "D:\Totty\webDevelopment\TottysWorld\src\pyamf\remoting\gateway\__init__.py", line 233, in __call__
        return self.service(self.method, args)
    ,  File "D:\Totty\webDevelopment\TottysWorld\src\pyamf\remoting\gateway\__init__.py", line 133, in __call__
        return func(*params)
    ,  File "D:\Totty\webDevelopment\TottysWorld\src\app\services\lists\get_contents.py", line 39, in get_contents
        item.uploaded_by_user = str(Image.uploaded_by_user.get_value_for_datastore(item))
    ,  File "C:\GAE\google\appengine\ext\db\__init__.py", line 3216, in __set__
        value = self.validate(value)
    ,  File "C:\GAE\google\appengine\ext\db\__init__.py", line 3246, in validate
        if value is not None and not value.has_key():
    ,AttributeError: 'str' object has no attribute 'has_key'

No more this error! instead of saving over the item.uploaded_by_user I save on item.uploaded_by_user_key. But The item.uploaded_by_user still loads the User model..

item.uploaded_by_user_key = str(Image.uploaded_by_user.get_value_for_datastore(item))

item is my Image in this case. As image inherents from item I call it item.

  • 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-18T01:02:04+00:00Added an answer on May 18, 2026 at 1:02 am
    class Image(db.Model):
        uploaded_by_user= db.ReferenceProperty(User)
    
    class User(db.Model):
        ...
    

    You could do:

    image = db.get(image_key)
    user_id = Image.uploaded_by_user.get_value_for_datastore(image).id()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two models, Room and Image . Image is a generic model that
I have a model, Thing, that has a has_many with ThingPhoto, using Paperclip to
I'm building a small web project using Django that has one model ( Image
I have created a formset from a model that has an ImageField inside it.
I currently have an image which has every suit and value of a deck
Here is a simplified version of my database model. I have two tables: Image,
I have a model Foo which have a ForeignKey to the User model. Later,
Let's say I have this model named Product with a field named brand .
I have a model with ImagePath and PDFPath properties. When they click save, that
Model Image http://screencast.com/t/ODkwZDQx http://screencast.com/t/ODkwZDQx I have a simple 3 table model built from my

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.