Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I did understand: An author can write / comment an article which is about one (only one?) product having a description and other properties, so I guess we should have something like this</p> <pre><code>class products(db.Model): name_product = db.StringProperty() # For Example description_product = db.StringProperty() # For Example class article(db.Model): my_product = db.ReferenceProperty(products, required=True) # Properties of the article title = db.StringProperty() body = db.TextProperty() author = db.StringProperty() aside = db.StringProperty() comment = db.StringProperty() date = db.DateProperty(auto_now_add=True) </code></pre> <p>In the case where one article would concern several products, then you may create another db model for mapping the articles and products. Since several products can be mentionned in several article, we would have:</p> <pre><code>class products(db.Model): name_product = db.StringProperty() # For Example description_product = db.StringProperty() # For Example class article(db.Model): # Properties of the article title = db.StringProperty() body = db.TextProperty() author = db.StringProperty() aside = db.StringProperty() comment = db.StringProperty() date = db.DateProperty(auto_now_add=True) class map_Article_Products(db.Model): my_article = db.ReferenceProperty(article, required=True) my_product = db.ReferenceProperty(products, required=True) </code></pre> <p><em><strong>Note that the db model "article" changes in this case</em></strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload