a guest Aug 13th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- def get_context_data(self, **kwargs):
- context = super(InvoiceDetail, self).dispatch(*args, **kwargs)
- request = self.request
- if request.GET:
- invoice_selector = request.GET.get('invoice_selector', None)
- invoice = Invoice.objects.get(id = int(invoice_selector) ) # either a string representing a number or 'add invoice'
- context_object_model = invoice
- except ValueError:
- return HttpResponseRedirect(reverse('accounting:add_invoice'))
- return context
RAW Paste Data