Commit 460cdb01 authored by Antoine Bernard's avatar Antoine Bernard Committed by Antoine Bernard

[factures] Création PDFView générique

dont Factureview hérite.
Elle servira de base à la vue qui permettra de générer des formulaires
d'adhésion.
parent 8b57ab4a
......@@ -54,12 +54,30 @@ class IndexView(CableurOrSelfMixin, View):
index = IndexView.as_view()
class FactureView(View):
class PDFView(View):
"""
Classe de view servant de base à la génération de PDF pour les
adhérents.
"""
tex_template = '404.tex'
context = {}
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(FactureView, self).dispatch(*args, **kwargs)
return super(PDFView, self).dispatch(*args, **kwargs)
def get(self, request):
return render_tex(
request,
self.tex_template,
self.context,
)
class FactureView(PDFView):
"""
View générant le fichier PDF d'une facture.
"""
tex_template = 'factures/facture.tex'
def get(self, request, fid):
luser = conn_pool.get_user(request.user)
......@@ -90,6 +108,16 @@ class FactureView(View):
date = u"Le %s à %s" % (jour, heure.replace(":", "h"))
# On récupère le montant restant à payer
topay = total - paid
return render_tex(request, 'factures/facture.tex', {'total':total, 'paid':paid, 'topay':topay, 'DATE':date, 'f':f, 'fid':fid})
self.context = {
'total':total,
'paid':paid,
'topay':topay,
'DATE':date,
'f':f,
'fid':fid,
}
return super(FactureView, self).get(request)
facture = FactureView.as_view()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment