From ed2fafe61afca8bba0f524613cbdc499650c29b4 Mon Sep 17 00:00:00 2001 From: R1kM Date: Fri, 17 Apr 2015 18:38:44 +0200 Subject: [PATCH] =?UTF-8?q?Vision=20des=20events=20diff=C3=A9renci=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calendrier/__pycache__/urls.cpython-34.pyc | Bin 476 -> 584 bytes calendrier/__pycache__/views.cpython-34.pyc | Bin 2832 -> 3322 bytes calendrier/urls.py | 2 ++ calendrier/views.py | 12 ++++++++++++ db.sqlite3 | Bin 53248 -> 53248 bytes templates/calendrier/home.html | 2 +- templates/calendrier/update.html | 10 ++++++++++ templates/calendrier/view_event.html | 3 +++ 8 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 templates/calendrier/update.html diff --git a/calendrier/__pycache__/urls.cpython-34.pyc b/calendrier/__pycache__/urls.cpython-34.pyc index b18916ff8c653909022d41d3ac984825fa2932a7..e9573fb52340506175078c2afa124d32613d7adc 100644 GIT binary patch delta 330 zcmYk0y-LJD6ot>7#LebsHHdCyX<-mtu&@$;3VTtua1bSUr-&voOyXKvtYBfa>&;T^VwkdLBI_E$}@aqrhGPwO%qZeBS=Cf zAO)yV1yT!{4QYcEfh{Njw!upniv@SUPRm^=8@I;7pK``7*lTSc9JJg6FE>1PAWg&y z&ZF?hdcG#>g^xA)}1gEpDI?OnxOp5eHC95y#}ujE(|4K&BWI J8zT=C0st`;C$0bh diff --git a/calendrier/__pycache__/views.cpython-34.pyc b/calendrier/__pycache__/views.cpython-34.pyc index fc826e0156c8c15afba54490253024c135874ae0..5ae82eb28f6ffcad6d77e8c0b0dbead4d4e104f7 100644 GIT binary patch delta 1357 zcmZuxOOG2x5U!pX+vD*#e#ETzA;F?NcAX7QHiAtgBD7)^5DJNqNI)`&(JYDd{klo|Ess;-)8??2jF$c+K_i()LG~OWL>z!8^A;O z24Hj=coX<3EBAo6fVZvO2HpYQwel;#(XD6YB@pP3J4>VX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y=Z+0J>krSIp_hP z!-zwg*AJZG2_Je6twx{qo=q<6J)fM`Q(r%I#+k2=oH@kL&X0RRW=EY=6;Vy)2&k&e zi+A>AGfgsgH)^F)DXJ(7c4O6Ur0uwq?kO^>1_-F)YC)BC&iy!h)~zbx97VE%KxR2B zu}LKTW?I$%osrD?8~8 zT$GR&urkWHIP(3Wmh?{Ug+rU_H{Q(QBocL%z-&KDj5Ji0z&M*nR&|vri@s9}1plg0 ziTyb$dHd8gN^Y7R-eao-Zjg)PqGKY>h8<3rD9G%~uH\d+)$', EventUpdate.as_view()), url(r'(?P\d+)/(?P\d+)/(?P\d+)/?', 'view_event'), url(r'(?P\d+)/(?P\d+)/?$', 'calendar'), url(r'(?P\d+)/?', 'view_eventbis'), diff --git a/calendrier/views.py b/calendrier/views.py index 24bba22..a567515 100644 --- a/calendrier/views.py +++ b/calendrier/views.py @@ -2,6 +2,8 @@ from django.shortcuts import render from calendrier.forms import EventForm from calendrier.models import Event from django.utils.safestring import mark_safe +from django.views.generic import UpdateView +from django.core.urlresolvers import reverse_lazy from partitions.decorators import chef_required from calendrier.calend import EventCalendar @@ -21,6 +23,8 @@ def calendar(request, pYear, pMonth): lCalendarFromMonth = datetime(lYear, lMonth, 1) lCalendarToMonth = datetime(lYear, lMonth, monthrange(lYear, lMonth)[1]) lEvents = Event.objects.filter(date__gte=lCalendarFromMonth, date__lte=lCalendarToMonth, calendrier=True) + if request.user.is_authenticated(): + lEvents = Event.objects.filter(date__gte=lCalendarFromMonth, date__lte=lCalendarToMonth) lCalendar = EventCalendar(lEvents).formatmonth(lYear, lMonth) lPreviousYear = lYear lPreviousMonth = lMonth - 1 @@ -83,4 +87,12 @@ def create_event(request): form = EventForm() return render(request, "calendrier/create.html", locals()) + +class EventUpdate(UpdateView): + model = Event + template_name = "calendrier/update.html" + form_class = EventForm + success_url = reverse_lazy(home) + + # Create your views here. diff --git a/db.sqlite3 b/db.sqlite3 index b9f15ee2591b54d98671306daedad75024b54812..dcbfef01840b0872ae775a7e33a03d8d647a42f8 100644 GIT binary patch delta 495 zcmZozz}&Ead4e?K?1?hYjI%c;oaJIHjA=Q3|+ zp2R$9W8)DfMz4vDikd3SzKn*(xkZ_UmSyEBDVY@}NvQ@|8Tq*t#_5U1DHVqKrKubs zMUzkMQrPU?{hC?SRM)@| ziH)|K&+RZ`p3HWJChKvRFsf}{%q^!QXslppYGq^rM0#dsh8AX~ zn=hFgIWWsI2Tf)VvEJAyz`QxAdJ_w(K=WD_Nj5H~e+=wQHyN1kFe@{AFy}IFXS&He ziRs_Q#)C|nD$Kr&nVD4urpCtQ8CAJCl{v))`|eWM?B4yFS=2<=$Q?)`f;_*favF)*BC^kzK476GOkOf#4gm=qbmZfv~CxcTc|9yV^~W(Fq46Aa93 zj3+iW?qRHNvgTy<(KPf?3b027V6V?&Iv078wy1 zV36o$X_#yjRvBUBl@V!Fl9QARRFLVFotW!Z8f9cr8fj!%n&RPA5SeKTHpnLzrY@+; zC)=%#5JO*gWra5(@xT+^)C) diff --git a/templates/calendrier/home.html b/templates/calendrier/home.html index 6b7c57d..147464c 100644 --- a/templates/calendrier/home.html +++ b/templates/calendrier/home.html @@ -16,7 +16,7 @@ << {{PreviousMonthName|frenchmonth}} {{PreviousYear}} - Today + Aujourd'hui {{NextMonthName|frenchmonth}} {{NextYear}} >> diff --git a/templates/calendrier/update.html b/templates/calendrier/update.html new file mode 100644 index 0000000..8f4561b --- /dev/null +++ b/templates/calendrier/update.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% block titre %}Modification{% endblock %} + +{% block content %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/templates/calendrier/view_event.html b/templates/calendrier/view_event.html index d1a736b..114e98e 100644 --- a/templates/calendrier/view_event.html +++ b/templates/calendrier/view_event.html @@ -3,6 +3,9 @@ {% block titre %}{{ nom }}{% endblock %} {% block content %} +{% if user.profile.is_chef %} +

Modifier l'événement

+{% endif %}

{{ nom }}

{{ev.date}}

{{ev.debut }}