Courtesy of Django docs, by the way: http://docs.djangoproject.com/en/1.2/ref/contrib/admin/actions/
On Tue, Feb 15, 2011 at 11:47 AM, Sithembewena Lloyd Dube <zebr...@gmail.com > wrote: > Solution found: I simply added a function call to the mailing function in > each action definition in admin.py as follows: > > actions = ['staking_approved', 'staking_in_process', > 'staking_rejected', 'staking_review_later'] > > > def save_model(self, request, obj, form, change): > staking_request = obj > obj.save() > send_staking_request_status_notification_email(staking_request) > > def staking_approved(modeladmin, request, queryset): > queryset.update(reviewed=1) > for obj in queryset: > send_staking_request_status_notification_email(obj) > > def staking_in_process(modeladmin, request, queryset): > queryset.update(reviewed=2) > for obj in queryset: > send_staking_request_status_notification_email(obj) > > def staking_rejected(modeladmin, request, queryset): > queryset.update(reviewed=3) > for obj in queryset: > send_staking_request_status_notification_email(obj) > > def staking_review_later(modeladmin, request, queryset): > queryset.update(reviewed=4) > for obj in queryset: > send_staking_request_status_notification_email(obj) > > Thanks. > > > On Tue, Feb 15, 2011 at 11:16 AM, Sithembewena Lloyd Dube < > zebr...@gmail.com> wrote: > >> Hi all, >> >> In my admin.py, I overrode the save() function of a model as follows: >> >> from myproject.myapp.functions import >> send_staking_request_status_notification_email >> >> def save_model(self, request, obj, form, change): >> staking_request = obj >> obj.save() >> send_staking_request_status_notification_email(staking_request) >> >> Therefore, when an admin user logs in and saves a record, an email is sent >> off to a site member. The function that does the emailing is imported from a >> custom module and this works fine. >> >> However, on the list page of said model in the admin area, the admin user >> is also able to select an action to apply to multiple records. How can I >> modify my admin.py so that the save() override specified above >> fires for all records? >> >> Thanks. >> -- >> Regards, >> Sithembewena Lloyd Dube >> > > > > -- > Regards, > Sithembewena Lloyd Dube > -- Regards, Sithembewena Lloyd Dube -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.