Commits

George Notaras committed cb1e142

Added export zone HTML link for every zone in changelist view.

  • Participants
  • Parent commits 1fb3f72

Comments (0)

Files changed (2)

src/powerdns_manager/admin.py

     
     fields = ('name', 'type', 'master', 'date_modified')
     readonly_fields = ('date_modified', )
-    list_display = ('name', 'type', 'master', 'date_modified')
+    list_display = ('name', 'export_zone_html_link', 'type', 'master', 'date_modified')
     list_filter = ('type', )
     search_fields = ('name', 'master')
     verbose_name = 'zone'

src/powerdns_manager/models.py

 from django.db.models import signals
 from django.utils.translation import ugettext_lazy as _
 from django.db.models.loading import cache
+from django.core.urlresolvers import reverse
 
 from powerdns_manager import settings
 from powerdns_manager import signal_cb
             soa_rr.content = ' '.join(bits)
             soa_rr.save()
     
+    def export_zone_html_link(self):
+        html_link = '<a href="%s"><strong>export zone</strong></a>' % reverse('export_zone', kwargs={'origin': self.name})
+        return html_link
+    export_zone_html_link.allow_tags = True
+    export_zone_html_link.short_description = 'Export'
+
 signal_cb.zone_saved.connect(signal_cb.rectify_zone_cb, sender=Domain)