first bill generation works
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
fd39526350
commit
d7c0c40926
6 changed files with 136 additions and 65 deletions
|
|
@ -27,8 +27,6 @@ class BillRecordInline(admin.TabularInline):
|
|||
class BillAdmin(admin.ModelAdmin):
|
||||
inlines = [ BillRecordInline ]
|
||||
|
||||
# change_list_template = "uncloud_pay/change_list.html"
|
||||
|
||||
def get_urls(self):
|
||||
"""
|
||||
Create URLs for PDF view
|
||||
|
|
@ -43,15 +41,6 @@ class BillAdmin(admin.ModelAdmin):
|
|||
|
||||
return url_patterns
|
||||
|
||||
# def changelist_view(self, request, extra_context=None):
|
||||
# extra_context = extra_context or {}
|
||||
|
||||
# print("view exec")
|
||||
# return super().changelist_view(
|
||||
# request, extra_context=extra_context,
|
||||
# )
|
||||
|
||||
|
||||
def my_view(self, request, object_id):
|
||||
bill = self.get_object(request, object_id=object_id)
|
||||
print(bill)
|
||||
|
|
@ -61,7 +50,7 @@ class BillAdmin(admin.ModelAdmin):
|
|||
|
||||
output_file = NamedTemporaryFile()
|
||||
bill_html = render_to_string("bill.html.j2", {'bill': bill,
|
||||
'bill_records': bill.bill_records.all()
|
||||
'bill_records': bill.billrecord_set.all()
|
||||
})
|
||||
|
||||
bytestring_to_pdf(bill_html.encode('utf-8'), output_file)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue