Reputation: 1895
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 make a form to create Entry where I can choose to add some of the tags ?
Upvotes: 1
Views: 168
Reputation: 5147
You will need to create a formset for your EntryTag
class. For more information, see the Django formset docs.
Otherwise, you may wish to create a custom form with a ModelMultipleChoiceField
and add the EntryTag
entities using a custom view.
Upvotes: 1