How can I represent a many-to-many relationship as Google App Engine?

class Entry(db.Model):
    ...

class Tag(db.Model):
    ...

class EntryTag(db.Model):
    entry = db.ReferenceProperty(Entry, required=True, collection_name='tag_set')
    tag = db.ReferenceProperty(Tag, required=True, collection_name='entry_set')

      

The template should be {{form.as_table}}

The question is how to create a form to create a post where can I add some tags?

+1


a source to share


1 answer


You will need to create a set of forms for your class EntryTag

. For more information see the Django docs .



Otherwise, you can create a custom form with ModelMultipleChoiceField

and add objects EntryTag

using a custom view.

+1


a source







All Articles