Пример #1
0
    def action_links(self, obj):
        links = []
        if reporter.can_report('invoice'):
            links.append(("<a href='{0}'>Print Invoice</a>"
                         .format(reverse(
                            'admin:checkout_invoice',
                            args=(obj.pk,)))))
        if reporter.can_report('order_confirmation'):
            links.append(("<a href='{0}'>Print Order Confirmation</a>"
                          .format(reverse(
                            'admin:checkout_order_confirmation',
                            args=(obj.pk,)))))

        return "<div>{0}</div>".format("&nbsp;/&nbsp;".join(links))
Пример #2
0
    def get_urls(self):
        urls = super(OrderAdmin, self).get_urls()

        if reporter.can_report('invoice'):
            urls = (patterns('',
                        url(r'^(.+)/invoice/$',
                        self.admin_site.admin_view(self.invoice),
                        name='checkout_invoice'),)
                    + urls)

        if reporter.can_report('order_confirmation'):
            urls = (patterns('',
                        url(r'^(.+)/order_confirmation/$',
                        self.admin_site.admin_view(self.order_confirmation),
                        name='checkout_order_confirmation'),)
                    + urls)

        return urls
Пример #3
0
 def get_attachments(self):
     if reporter.can_report('invoice'):
         report = reporter.get_report(
             'invoice',
             context={
                 'order': self.order,
             }
         )
         return [(report.filename, report.data, report.mimetype)]
Пример #4
0
 def get_attachments(self):
     if reporter.can_report('order_confirmation'):
         report = reporter.get_report(
             'order_confirmation',
             context={
                 'order': self.order
             }
         )
         return [(report.filename, report.data, report.mimetype)]