title: Django Admin: making bulk admin actions with a class
body: <p>I've been trying to automate the creation of a series of admin actions in Django.</p>
  
  <p>Basically I want to create the possibility to bulk change a status field on a Project object. The status field is a ForeignkeyField.</p>
  
  <p>I thought making a Class like this would work:</p>
  
  <pre><code>class StatusAction(object):
  
      def __init__(self,status):
           self.status = status
  
      def make_action(self, modeladmin, request, queryset):
          self.queryset = queryset.update(status=self.status)
  
      make_action.short_description = "Change status to '%s' for selected projects" % status
  </code></pre>
  
  <p>and then declare the actions like :</p>
  
  <pre><code>actions = [StatusAction(s.id).make_action for s in Status.objects.all()]
  </code></pre>
  
  <p>I am encountering two problems:</p>
  
  <ul>
  <li>Only one action ends up in the Admin interface (the last declerated).</li>
  <li>the make_action.short_description attribute has class scope, so I can't make it specific for each instance. putting self.make_action.short_description in make_action doesn't work either.</li>
  </ul>
  
  <p>I also tried doing this with a closure (function in a function). It solves the attribute of a function problem, but still only one action ends up in the admin.</p>