Attention ! Gitlab fournissant maintenant nativement des certificats Let’s Encrypt aux domaines personnalisés des Gitlab Pages, nous avons coupé notre service qui le faisait automatiquement pour vous.

Il est impératif, pour que votre domaine personnalisé continue à avoir un certificat Let’s Encrypt à jour, d’activer la fonctionnalité native dans les paramètres de votre projet. Cette activation remplacera votre certificat actuel par un nouveau certificat Let’s Encrypt géré par Gitlab.

Voir les détails sur https://docs.framasoft.org/fr/gitlab/gitlab-pages-le.html

Commit 511cf4a2 authored by fred.perso's avatar fred.perso

add synthesis app

parent 839cbd9b
......@@ -78,7 +78,7 @@ class UserAdminUpdate(ManageAccountAuthMixin, UpdateView):
template_name = 'leaflet_form.html'
def form_valid(self, form):
form.instance.updated_by = self.request.user
form.instance.updated_by = self.request.user.username
return super(UserAdminUpdate, self).form_valid(form)
def get_context_data(self, **kwargs):
......
......@@ -42,6 +42,7 @@ urlpatterns = [
url(r'', include('blog.urls', namespace='blog')),
url(r'', include('sights.urls', namespace='sights')),
url(r'', include('management.urls', namespace='management')),
url(r'^synthesis/', include('synthesis.urls', namespace='synthesis')),
url(r'^api/', include('api.urls', namespace='api')),
] + static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
......
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class SynthesisConfig(AppConfig):
name = 'synthesis'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.conf.urls import url
from .views import AnnualContribView
urlpatterns = [
# url de recherches de localités
url(r'^contrib$', AnnualContribView.as_view(), name='contrib'),
]
import datetime
from django.views.generic import TemplateView
from sights.models import Sighting, Session
datetime.datetime.year
import arrow
class AnnualContribView(TemplateView):
template_name = 'synthesis/annual_contrib.html'
def get_context_data(self, **kwargs):
context = super(AnnualContribView, self).get_context_data(**kwargs)
context['month_contrib'] = self.month_contrib()
context['list_year'] = self.list_year()
context['year_contrib'] = self.year_contrib()
return context
def month_contrib(self):
final_data = []
date = arrow.now()
for month in range(1, 12):
date = date.replace(months=-1)
count = Sighting.objects.filter(
session__date_start__gte=date.floor('month').datetime,
session__date_start__lte=date.ceil('month').datetime).count()
final_data.append(count)
return final_data
def list_year(self):
list_year = []
first_year = Session.objects.all().order_by('date_start')[:1].get().date_start.year
last_year = Session.objects.all().order_by('-date_start')[:1].get().date_start.year
for year in range(first_year, last_year):
list_year.append(year)
return list_year
def year_contrib(self):
final_data = []
date = arrow.now()
for year in self.list_year():
date = date.replace(years=-1)
count = Sighting.objects.filter(
session__date_start__gte=date.floor('year').datetime,
session__date_start__lte=date.ceil('year').datetime).count()
final_data.append(count)
final_data.reverse()
return final_data
{% extends "base.html" %}
{% block content %}
<script src="//cdnjs.cloudflare.com/ajax/libs/Chart.js/0.2.0/Chart.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
<style>
canvas {
height: 100vh;
width: 100vw;
display: block;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
var data = {
labels: {{ list_year }},
datasets: [
{
label: "Contrib during last year",
fillColor: "rgba(220,220,220,0.2)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: {{ year_contrib }}
}
]
};
var ctx = document.getElementById("myChart").getContext("2d");
var myLineChart = new Chart(ctx).Line(data);
});
</script>
<div class="row">
<h1><i class="fi-target"></i> Synthèses</h1>
<div class="large-12 columns">
<canvas id="myChart" width="1024" height="500"></canvas>
</div>
</div>
{% endblock %}
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