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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:21:56+00:00 2026-05-31T15:21:56+00:00

Changing question. I Want to apply ManyToMany relationship between db.Model and NDB . example

  • 0

Changing question. I Want to apply ManyToMany relationship between db.Model and NDB.
example

NDB model

class my_NDB(search.SearchableModel):
   .......
   .......

db model

class Test(search.SearchableModel):
  email = db.StringProperty()
  created_by = db.IntegerProperty()

Can I apply ManyToMany relationship between these models?

EDIT:

Here is my User Model

  class User(model.Expando):
    """Stores user authentication credentials or authorization ids."""

    #: The model used to ensure uniqueness.
    unique_model = Unique
    #: The model used to store tokens.
    token_model = UserToken

    created = model.DateTimeProperty(auto_now_add=True)
    updated = model.DateTimeProperty(auto_now=True)
    # ID for third party authentication, e.g. 'google:username'. UNIQUE.
    auth_ids = model.StringProperty(repeated=True)
    # Hashed password. Not required because third party authentication
    # doesn't use password.
    email = model.StringProperty(required=True)
    is_active = model.BooleanProperty(required=True)
    password = model.StringProperty()

And Here is my Test db model

class Test(search.SearchableModel):
  email = db.StringProperty()
  created_by = db.IntegerProperty()

Now I want to apply manyToMany on Test. Is it possible?

Django style ManyToMany

created_by = models.ManyToManyField(User)
  • 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-31T15:21:58+00:00Added an answer on May 31, 2026 at 3:21 pm

    I see. I had to look up the Django ManyToManyField docs. IIUC you want a Test to be created by multiple users, and of course each user can create multiple tests. Have I got that right?

    The way to do this would be to have a db.ListProperty(db.Key) in the Test class, so that the Test class has a list of keys — where the keys point to User entities.

    Now your User model is an NDB class, which complicates matters a bit. However the ndb Key class has an API for converting to and from db Keys:

    • If you have an ndb Key k, k.to_old_key() returns the corresponding db.Key.

    • If you have a db Key k, ndb.Key.from_old_key(k) returns the ndb.Key for it (it’s a class method).

    Hope this helps. Good luck!

    PS. Please update your code to use from google.appengine.ext import ndb so you can write ndb.Expando, ndb.StringProperty, etc.

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

Sidebar

Related Questions

related question with unsatisfactory answers: Changing CSS Values with Javascript Here's what I want
Ok... changing the question here... I'm getting an error when I try this: SELECT
I am refering to the question on changing the classpath programmatically. I read and
I have an interesting question. Imagine I have a lot of data changing in
I've got the following code from another question on SO to track the changing
Please note: I am asking the question I want answered. I know this question
I have a question regarding changing parameter types in virtual methods. First I'll explain
A very basic question : I want to bind a wpf ComboBox to a
I asked this question regarding changing the position of a bootstrap popover depending on
I just have a question regarding changing an Activities layout. Basicly my problem is:

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.