1π
β
I think you want to use the messages framework.
In an admin action:
class FooAdmin(admin.ModelAdmin):
....
def foo_action(self, request, queryset):
....
self.message_user(request, "%s foo objects were not saved" % foos_not_saved)
In a (model)form:
def save(*args, **kwargs):
# do stuff
self.message_user(request, "%s fields were not saved" % ','.join(fields_not_saved))
π€shanyu
0π
I believe the message is just js. The javascript for the admin site lives in djangoX.X/django/contrib/admin/media/js/
and I believe you can change the message in actions.js
.
Alternatively you can go into djangoX.X/django/contrib/admin/templates/admin/
and over ride the js from there.
π€Daniel Nill
- [Django]-Django posts and responses
- [Django]-Records getting deleted from Mysql table automatically
- [Django]-RabbitMQ keeps connections running for a long time
- [Django]-Unique email constraint for django.contrib.auth.user
- [Django]-Django on Aptana Studio 3.0
Source:stackexchange.com