Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class EmpresaAdmin(admin.ModelAdmin):
- list_display = ('nome', 'telefone', 'cnpj',)
- search_fields = ('nome', 'cnpj',)
- list_filter = ( 'nome', 'cnpj', 'telefone', )
- class AssociadoAdmin(admin.ModelAdmin):
- list_display = ('nome', 'endereco', 'telefone', 'cpf', 'data_filiacao', 'data_nascimento' )
- search_fields = ('nome', 'cpf',)
- list_filter = ( 'nome', 'cpf', 'telefone', )
- class AgendamentoAdmin(admin.ModelAdmin):
- list_display = ('nome','inicio', 'fim','assunto', )
- search_fields = ('nome', 'cpf',)
- list_filter = ( 'nome', 'inicio', 'assunto', )
- #views
- class Render:
- @staticmethod
- def render(path: str, params: dict, filename: str):
- template = get_template(path)
- html = template.render(params)
- response = io.BytesIO()
- pdf = pisa.pisaDocument(
- io.BytesIO(html.encode("UTF-8")), response)
- if not pdf.err:
- response = HttpResponse(
- response.getvalue(), content_type='application/pdf')
- response['Content-Disposition'] = 'attachment;filename=%s.pdf' % filename
- return response
- else:
- return HttpResponse("Error Rendering PDF", status=400)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement