forked from DGNum/gestioCOF
putting away some code for future improvments
This commit is contained in:
parent
de9387c6ad
commit
219835be17
2 changed files with 0 additions and 203 deletions
|
@ -8,165 +8,10 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-md-3 col-content-left">
|
||||
<div class="content-left">
|
||||
<div class="content-left-top">
|
||||
<div class="line line-big">Trucs</div>
|
||||
<div class="line line-bigsub">à dire</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<a class="btn btn-primary btn-lg" href="#TODO">Choix 1</a>
|
||||
<a class="btn btn-primary btn-lg" href="#TODO">Choix 2</a>
|
||||
<a class="btn btn-primary btn-lg" href="#TODO">Choix 3</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8 col-md-9 col-content-right">
|
||||
{% include 'kfet/base_messages.html' %}
|
||||
<div class="content-right">
|
||||
<div class="content-right-block content-right-block-transparent">
|
||||
<h2>Liste des trucs</h2>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-6 col-lg-4 nopadding">
|
||||
<div class="panel-md-margin">
|
||||
<h3>Répartition des câlins</h3>
|
||||
<canvas id="myChart1" width="200" height="200"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 col-lg-4 nopadding">
|
||||
<div class="panel-md-margin">
|
||||
<h3>Répartition des câlins</h3>
|
||||
<canvas id="myChart2" width="200" height="200"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 col-lg-4 nopadding">
|
||||
<div class="panel-md-margin">
|
||||
<h3>Répartition des câlins</h3>
|
||||
<canvas id="myChart3" width="200" height="200"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end row -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
<script src="{% static 'kfet/js/Chart.bundle.js' %}"></script>
|
||||
<script>
|
||||
jQuery(document).ready(function() {
|
||||
var ctx1 = $("#myChart1");
|
||||
var ctx2 = $("#myChart2");
|
||||
var ctx3 = $("#myChart3");
|
||||
var myChart = new Chart(ctx1, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
var myChart = new Chart(ctx2, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
var myChart = new Chart(ctx3, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
|
||||
datasets: [{
|
||||
label: '# of Votes',
|
||||
data: [12, 19, 3, 5, 2, 3],
|
||||
backgroundColor: [
|
||||
'rgba(255, 99, 132, 0.2)',
|
||||
'rgba(54, 162, 235, 0.2)',
|
||||
'rgba(255, 206, 86, 0.2)',
|
||||
'rgba(75, 192, 192, 0.2)',
|
||||
'rgba(153, 102, 255, 0.2)',
|
||||
'rgba(255, 159, 64, 0.2)'
|
||||
],
|
||||
borderColor: [
|
||||
'rgba(255,99,132,1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
],
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero:true
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
|
@ -2534,51 +2534,3 @@ class ArticleStatLastMonth(ArticleStatLast):
|
|||
def get_labels(self, **kwargs):
|
||||
months = lastmonths(7)
|
||||
return monthnames(months)
|
||||
|
||||
# ------------------------------
|
||||
# Article Statistique Catégories
|
||||
# ------------------------------
|
||||
|
||||
|
||||
class DurationStat(HybridListView):
|
||||
lookup_duration_type = 'day' # 'day' || 'week' || 'month'
|
||||
lookup_duration_number = 3 # ie ici : 3 jours
|
||||
|
||||
def get_end_date(self, **kwargs):
|
||||
if self.lookup_duration_type == 'day':
|
||||
return this_morning()
|
||||
elif self.lookup_duration_type == 'week':
|
||||
return this_monday_morning()
|
||||
elif self.lookup_duration_type == 'month':
|
||||
return this_first_month_day()
|
||||
else:
|
||||
raise ValueError('duration_type invalid')
|
||||
|
||||
def get_begining_date(self, **kwargs):
|
||||
end_date = self.get_end_date(self, **kwargs)
|
||||
if self.lookup_duration_type == 'day':
|
||||
days = self.lookup_nb_duration
|
||||
elif self.lookup_duration_type == 'week':
|
||||
days = 7*self.lookup_nb_duration
|
||||
elif self.lookup_duration_type == 'month':
|
||||
days = 30*self.lookup_nb_duration
|
||||
else:
|
||||
raise ValueError('this should not be happening.')
|
||||
delta = timezone.timedelta(days=days)
|
||||
return end_date - delta
|
||||
|
||||
@method_decorator(login_required)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(DurationStat, self).dispatch(*args, **kwargs)
|
||||
|
||||
|
||||
# TODO
|
||||
# class CategoryDurationStat(DurationStat):
|
||||
# model = ArticleCategory
|
||||
# template_name = 'kfet/category_stat.html'
|
||||
#
|
||||
# def get_context_data(self, **kwargs):
|
||||
# context = {}
|
||||
# queryset = kwargs.pop('object_list', self.object_list)
|
||||
#
|
||||
# return context
|
||||
|
|
Loading…
Reference in a new issue