mardi 24 février 2015

How can I use Django's messages framework to append to an admin success message from an inline form?

We have something like the following:



class SecondaryItemInline(admin.TabularInline):
model = SecondaryItem
form = SecondaryItemForm

class PrimaryItemAdmin(admin.ModelAdmin):
inlines = SecondaryItemInline,


What I would like to do is to add a custom message to the default Django admin success message from the clean method of SecondaryItemForm. I am seeing how to do this from SecondaryItemForm using save_model, but not seeing anything on doing this from an inline form. Any ideas?


Aucun commentaire:

Enregistrer un commentaire