python - Examine current messages in Django admin.py -


using django 1.5, python 2.7

is there way can examine messages have been added message object in admin.py file? in admin model, overwriting save_model function, , stop "model changed" message if doesn't meet criteria.

from django.contrib import admin, messages  class exampleadmin(admin.modeladmin):     list_display = ('whatever', 'etc')      def save_model(self, request, obj, form, change):         obj.save()         # want @ messages right here 

use get_messages.

example:

from django.contrib import admin, messages   class exampleadmin(admin.modeladmin):     list_display = ('whatever', 'etc')      def save_model(self, request, obj, form, change):         obj.save()         storage = messages.get_messages(request)         message in storage:             # examine message here.             pass 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -