docstring instead of comments

This commit is contained in:
Qwann 2017-01-20 20:13:03 +01:00
parent e6854d7987
commit f8c49ae90c

View file

@ -1986,11 +1986,13 @@ class JSONResponseMixin(object):
return context
# Rend un DetailView en html sauf si on lui précise dans
# l'appel à get que l'on veut un json auquel cas il en rend un
class HybridDetailView(JSONResponseMixin,
SingleObjectTemplateResponseMixin,
BaseDetailView):
"""
Returns a DetailView as a html page except if it asked a JSON
file by the GET method in witch case it returns a JSON response.
"""
def render_to_response(self, context):
# Look for a 'format=json' GET argument
if self.request.GET.get('format') == 'json':
@ -2012,9 +2014,11 @@ class HybridListView(JSONResponseMixin,
return super(HybridListView, self).render_to_response(context)
# Un résume des toutes les vues de stat d'un objet
# NE REND PAS DE JSON
class ObjectResumeStat(DetailView):
"""
Summarize all the stats of an object
DOES NOT RETURN A JSON RESPONSE
"""
template_name = 'kfet/object_stat_resume.html'
context_object_name = 'lul'
id_prefix = 'id_a_definir'
@ -2093,11 +2097,13 @@ class AccountStatBalanceAll(ObjectResumeStat):
return super(AccountStatBalanceAll, self).dispatch(*args, **kwargs)
# Rend un graphe (ou un json) de l'évolution de la balance personelle
# entre begin_date et end_date
# prend en compte les opérations et les transferts
# ne prend pas en compte les balance offset (TODO?)
class AccountStatBalance(HybridDetailView):
"""
Returns a graph (or a JSON Response) of the evolution a the personnal
balance of a trigramm between begin_date and end_date
takes into account the Operations and the Transfers
does not takes intto account the balance offset
"""
model = Account
trigramme_url_kwarg = 'trigramme'
template_name = 'kfet/account_stat_balance.html'
@ -2276,6 +2282,10 @@ class AccountStatLastAll(ObjectResumeStat):
class AccountStatLast(HybridDetailView):
"""
Returns a graph (or a JSON Response) of the evolution a the personnal
consommation of a trigramm at the diffent dates precised
"""
model = Account
trigramme_url_kwarg = 'trigramme'
template_name = 'kfet/account_stat_last.html'
@ -2413,9 +2423,11 @@ class ArticleStatLastAll(ObjectResumeStat):
return super(ArticleStatLastAll, self).dispatch(*args, **kwargs)
# Rend un graph des ventes sur une plage de temps à préciser.
# Le graphique distingue les ventes sur LIQ et sur les autres trigrammes
class ArticleStatLast(HybridDetailView):
"""
Returns a graph (or a JSON Response) of the consommation
of an article at the diffent dates precised
"""
model = Article
template_name = 'kfet/article_stat_last.html'
context_object_name = 'article'