title: How do I trigger a Celery task from Django admin?
body: <p>I have a model called <code>Publication</code> and I'd like to add a button to the list view in Django Admin which would allow triggering a Celery task. </p>
  
  <p><code>admin.py</code>:</p>
  
  <pre><code>from django.contrib import admin
  from .models import Publication
  
  
  class PublicationAdmin(admin.ModelAdmin):
      change_list_template = "variants/admin_publication_list.html"
  
      def update(self, request):
          # trigger task
          # redirect to admin list
  
  admin.site.register(Publication, PublicationAdmin)
  </code></pre>
  
  <p><code>variants/admin_publication_list.html</code>:</p>
  
  <pre><code>{% extends 'admin/change_list.html' %}
  
  {% block object-tools %}
    &lt;li&gt;
      &lt;a href="/admin/variants/publication/update/"&gt;
        Update
      &lt;/a&gt;
    &lt;/li&gt;
    {{ block.super }}
  {% endblock %}
  </code></pre>
  
  <p>However when I press a button I only get a notice:</p>
  
  <blockquote>
    <p>Publication with ID “update” doesn’t exist. Perhaps it was deleted?</p>
  </blockquote>