From c3f1d312f1ecec64ee077431dda04be4ba2ad500 Mon Sep 17 00:00:00 2001 From: alazo Date: Mon, 19 Feb 2018 07:51:50 +0100 Subject: [PATCH 1/2] Cancel_get_context_modif --- cms/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cms/views.py b/cms/views.py index 2d4f3f1..d4924ae 100644 --- a/cms/views.py +++ b/cms/views.py @@ -7,7 +7,7 @@ import os import tempfile from django.views.generic import ListView, TemplateView, DetailView -from django.db.models import F, Sum +from django.db.models import F, Sum, Q from django.http import HttpResponse from cms.pdf import PeriodSemesterPdf, ModuleDescriptionPdf, FormationPlanPdf @@ -133,6 +133,7 @@ def get_context(context): """ # liste = Module.objects.exclude(total_presentiel=0) liste = Module.objects.filter(pratique_prof=0) + context['sem1'] = liste.exclude(sem1=0) context['tot1'] = liste.aggregate(Sum(F('sem1')))['sem1__sum'] context['sem2'] = liste.exclude(sem2=0) From 129162c2f949a825cbdf629a9ffed247e9c927bd Mon Sep 17 00:00:00 2001 From: alazo Date: Mon, 19 Feb 2018 14:50:14 +0100 Subject: [PATCH 2/2] Clean urls.py --- common/urls.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/common/urls.py b/common/urls.py index a68fe91..c58923a 100644 --- a/common/urls.py +++ b/common/urls.py @@ -1,17 +1,5 @@ """eds URL Configuration -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/1.10/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.conf.urls import url, include - 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ import os from django.urls import path, re_path, include @@ -23,7 +11,6 @@ from cms import views urlpatterns = [ path('', views.HomeView.as_view(), name='home'), - # url(r'^plan_pdf/$', views.HomePDFView.as_view(), name='plan-pdf'), path('plan_pdf/', views.print_plan_formation, name='plan-pdf'), path('admin/', admin.site.urls), path('domaine//', views.DomaineDetailView.as_view(), name='domaine-detail'), @@ -41,11 +28,9 @@ urlpatterns = [ path('upload/', views.UploadDocListView.as_view(), name='uploaddoc-list'), path('document//', views.ConceptDetailView.as_view(), name='concept-detail'), path('upload//', views.UploadDocDetailView.as_view(), name='uploaddoc-detail'), - - # url(r'^emplois/$', views.EmploiListView.as_view(), name='emploi-list'), path('tinymce/', include('tinymce.urls'), name='tinymce-js'), - # Serve bulletins by Django to allow LoginRequiredMiddleware to apply + # Serve docs by Django to allow LoginRequiredMiddleware to apply path('media/doc/', serve, {'document_root': os.path.join(settings.MEDIA_ROOT, 'doc'), 'show_indexes': False} ),