Call model methods on object from admin interface
|Reported by:||Rudolph||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
It would be really nice if you could add buttons to the admin interface of an object. A click on the button calls the corresponding model method:
class Subscriber(models.Model): name = models.CharField('name', maxlength=40) def send_invoice(self): """Sends invoice by e-mail to subscriber.""" pass class Admin: actions = (('send_invoice', _('Send invoice')),)
This would create a button with the text 'Send invoice' in the admin interface of the object. The "actions" syntax should probably also allow passing arguments to the method.