This is how my models look:
class QuestionTagM2M(models.Model):
tag = models.ForeignKey(\'Tag\')
question = models.ForeignKey(\'Question\')
date_
The docs may have changed since the previous answers were posted. I took a look at the django docs link that @Irfan mentioned and it seems to be a more straight forward then it used to be.
Add an inline class to your admin.py
and set the model to your M2M model
class QuestionTagM2MInline(admin.TabularInline):
model = QuestionTagM2M
extra = 1
set inlines
in your admin class to contain the Inline you just defined
class QuestionAdmin(admin.ModelAdmin):
#...other stuff here
inlines = (QuestionTagM2MInline,)
Don't forget to register this admin class
admin.site.register(Question, QuestionAdmin)
After doing the above when I click on a question I have the form to do all the normal edits on it and below that are a list of the elements in my m2m relationship where I can add entries or edit existing ones.