Bawa
This commit is contained in:
parent
ed2fafe61a
commit
20a02d1013
57 changed files with 698 additions and 44 deletions
Binary file not shown.
Binary file not shown.
|
@ -40,6 +40,7 @@ INSTALLED_APPS = (
|
||||||
'gestion',
|
'gestion',
|
||||||
'partitions',
|
'partitions',
|
||||||
'calendrier',
|
'calendrier',
|
||||||
|
'propositions',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
|
|
|
@ -14,6 +14,8 @@ urlpatterns = patterns('',
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
url(r'^partitions/', include('partitions.urls')),
|
url(r'^partitions/', include('partitions.urls')),
|
||||||
url(r'^calendar/', include('calendrier.urls')),
|
url(r'^calendar/', include('calendrier.urls')),
|
||||||
|
url(r'^propositions/', include('propositions.urls')),
|
||||||
|
url(r'^divers/', 'gestion.views.divers'),
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -19,7 +19,7 @@ class EventCalendar(HTMLCalendar):
|
||||||
cssclass += ' filled'
|
cssclass += ' filled'
|
||||||
body = []
|
body = []
|
||||||
for ev in self.events[day]:
|
for ev in self.events[day]:
|
||||||
body.append('<a href="calendar/%s">' % ev.id)
|
body.append('<a href="/calendar/%s">' % ev.id)
|
||||||
body.append(esc(ev.nom))
|
body.append(esc(ev.nom))
|
||||||
body.append('</a><br/>')
|
body.append('</a><br/>')
|
||||||
return self.day_cell(cssclass, '<div class="dayNumber">%d</div> %s' % (day, ''.join(body)))
|
return self.day_cell(cssclass, '<div class="dayNumber">%d</div> %s' % (day, ''.join(body)))
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from calendrier.models import Event
|
from calendrier.models import Event, Participants
|
||||||
|
|
||||||
class EventForm(forms.ModelForm):
|
class EventForm(forms.ModelForm):
|
||||||
|
sendmail = forms.BooleanField(initial=False, label="Envoyer l'invitation à la liste fanfare")
|
||||||
|
message = forms.CharField(max_length=2000, widget=forms.Textarea(attrs={"placeholder":"Remplir ici pour remplacer le mail automatique"}), required=False)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Event
|
model = Event
|
||||||
widgets = {
|
widgets = {
|
||||||
|
@ -10,4 +12,8 @@ class EventForm(forms.ModelForm):
|
||||||
'debut': forms.TextInput(attrs={"placeholder": 'hh:mm'}),
|
'debut': forms.TextInput(attrs={"placeholder": 'hh:mm'}),
|
||||||
'fin': forms.TextInput(attrs={"placeholder": 'hh:mm facultatif'})
|
'fin': forms.TextInput(attrs={"placeholder": 'hh:mm facultatif'})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ParticipantsForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Participants
|
||||||
|
fields = ('reponse', )
|
||||||
|
|
|
@ -1,14 +1,31 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from gestion.models import ErnestoUser
|
||||||
|
|
||||||
|
ANSWERS = (
|
||||||
|
('oui', 'Oui'),
|
||||||
|
('non', 'Non'),
|
||||||
|
('pe', 'Peut-être'),
|
||||||
|
)
|
||||||
|
|
||||||
class Event(models.Model):
|
class Event(models.Model):
|
||||||
nom = models.CharField(max_length=100)
|
nom = models.CharField(max_length=100)
|
||||||
date = models.DateField()
|
date = models.DateField()
|
||||||
debut = models.TimeField()
|
debut = models.TimeField()
|
||||||
fin = models.TimeField(blank=True, null=True)
|
fin = models.TimeField(blank=True, null=True)
|
||||||
|
slug = models.CharField(max_length=7, editable=False, unique=True)
|
||||||
lieu = models.CharField(max_length=200)
|
lieu = models.CharField(max_length=200)
|
||||||
description = models.TextField(blank=True)
|
description = models.TextField(blank=True)
|
||||||
calendrier = models.BooleanField(default=False, verbose_name="Afficher dans le calendrier")
|
calendrier = models.BooleanField(default=False, verbose_name="Afficher dans le calendrier")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.nom
|
return self.nom
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = "Événement"
|
||||||
|
|
||||||
|
class Participants(models.Model):
|
||||||
|
event = models.ForeignKey(Event)
|
||||||
|
participant = models.ForeignKey(ErnestoUser)
|
||||||
|
reponse = models.CharField("Réponse", max_length = 20, default = "non", choices = ANSWERS)
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
from calendrier.views import EventUpdate
|
from calendrier.views import EventUpdate, EventDelete
|
||||||
|
|
||||||
urlpatterns = patterns('calendrier.views',
|
urlpatterns = patterns('calendrier.views',
|
||||||
url(r'^new$', 'create_event'),
|
url(r'^new$', 'create_event'),
|
||||||
url(r'^$', 'home'),
|
url(r'^$', 'home'),
|
||||||
url(r'^edition/(?P<pk>\d+)$', EventUpdate.as_view()),
|
url(r'^edition/(?P<pk>\d+)$', EventUpdate.as_view()),
|
||||||
|
url(r'^supprimer/(?P<pk>\d+)$', EventDelete.as_view()),
|
||||||
|
url(r'(?P<id>\d+)/reponse/?', 'reponse'),
|
||||||
|
url(r'(?P<codeus>\w{6})/(?P<codeev>\w{6})/oui', 'repouidir'),
|
||||||
|
url(r'(?P<codeus>\w{6})/(?P<codeev>\w{6})/pe', 'reppedir'),
|
||||||
|
url(r'(?P<codeus>\w{6})/(?P<codeev>\w{6})/non', 'repnondir'),
|
||||||
url(r'(?P<pYear>\d+)/(?P<pMonth>\d+)/(?P<id>\d+)/?', 'view_event'),
|
url(r'(?P<pYear>\d+)/(?P<pMonth>\d+)/(?P<id>\d+)/?', 'view_event'),
|
||||||
url(r'(?P<pYear>\d+)/(?P<pMonth>\d+)/?$', 'calendar'),
|
url(r'(?P<pYear>\d+)/(?P<pMonth>\d+)/?$', 'calendar'),
|
||||||
url(r'(?P<id>\d+)/?', 'view_eventbis'),
|
url(r'(?P<id>\d+)/?', 'view_eventbis'),
|
||||||
|
|
|
@ -1,15 +1,24 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from calendrier.forms import EventForm
|
from calendrier.forms import EventForm, ParticipantsForm
|
||||||
from calendrier.models import Event
|
from calendrier.models import Event, Participants
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.views.generic import UpdateView
|
from django.views.generic import UpdateView, DeleteView
|
||||||
from django.core.urlresolvers import reverse_lazy
|
from django.core.urlresolvers import reverse_lazy
|
||||||
from partitions.decorators import chef_required
|
from partitions.decorators import chef_required
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from gestion.models import ErnestoUser
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
|
|
||||||
|
import smtplib
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
|
||||||
from calendrier.calend import EventCalendar
|
from calendrier.calend import EventCalendar
|
||||||
from calendar import monthrange
|
from calendar import monthrange
|
||||||
from datetime import *
|
from datetime import *
|
||||||
|
|
||||||
|
from propositions.utils import generer
|
||||||
|
|
||||||
def named_month(pMonthNumber):
|
def named_month(pMonthNumber):
|
||||||
return date(1900, pMonthNumber, 1).strftime('%B')
|
return date(1900, pMonthNumber, 1).strftime('%B')
|
||||||
|
|
||||||
|
@ -57,6 +66,10 @@ def view_event(request, pYear, pMonth, id):
|
||||||
nom = ev.nom.capitalize
|
nom = ev.nom.capitalize
|
||||||
fin = False
|
fin = False
|
||||||
desc = False
|
desc = False
|
||||||
|
part = ev.participants_set.all()
|
||||||
|
nboui = len(part.filter(reponse="oui"))
|
||||||
|
nbpe = len(part.filter(reponse="pe"))
|
||||||
|
nbnon = len(part.filter(reponse="non"))
|
||||||
if ev.fin:
|
if ev.fin:
|
||||||
fin = True
|
fin = True
|
||||||
if ev.description:
|
if ev.description:
|
||||||
|
@ -65,9 +78,13 @@ def view_event(request, pYear, pMonth, id):
|
||||||
|
|
||||||
def view_eventbis(request, id):
|
def view_eventbis(request, id):
|
||||||
ev = Event.objects.get(id=id)
|
ev = Event.objects.get(id=id)
|
||||||
|
part = ev.participants_set.all()
|
||||||
nom = ev.nom.capitalize
|
nom = ev.nom.capitalize
|
||||||
fin = False
|
fin = False
|
||||||
desc = False
|
desc = False
|
||||||
|
nboui = len(part.filter(reponse="oui"))
|
||||||
|
nbpe = len(part.filter(reponse="pe"))
|
||||||
|
nbnon = len(part.filter(reponse="non"))
|
||||||
if ev.fin:
|
if ev.fin:
|
||||||
fin = True
|
fin = True
|
||||||
if ev.description:
|
if ev.description:
|
||||||
|
@ -79,20 +96,134 @@ def create_event(request):
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
form = EventForm(request.POST)
|
form = EventForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
temp = True
|
||||||
form.save()
|
while temp:
|
||||||
|
code = generer()
|
||||||
|
try:
|
||||||
|
Event.objects.get(slug=code)
|
||||||
|
except:
|
||||||
|
temp=False
|
||||||
|
sendmail = form.cleaned_data["sendmail"]
|
||||||
|
nom = form.cleaned_data["nom"]
|
||||||
|
date = form.cleaned_data["date"]
|
||||||
|
date = date.strftime('%d/%m/%Y')
|
||||||
|
debut = form.cleaned_data["debut"]
|
||||||
|
message = form.cleaned_data["message"]
|
||||||
|
obj = form.save(commit=False)
|
||||||
|
id= obj.id
|
||||||
|
obj.slug = code
|
||||||
|
obj.save()
|
||||||
envoi = True
|
envoi = True
|
||||||
|
if sendmail:
|
||||||
|
try:
|
||||||
|
smtpObj = smtplib.SMTP('clipper.ens.fr', 25)
|
||||||
|
sender = 'fanfare@ens.fr'
|
||||||
|
receivers = 'aymeric.fromherz@ens.fr'
|
||||||
|
msg = MIMEMultipart("alternative")
|
||||||
|
msg["Subject"] = nom + ", le " + date
|
||||||
|
msg["From"] = sender
|
||||||
|
msg["To"] = receivers
|
||||||
|
text = "Bonjour, un évémenent a été créé."
|
||||||
|
if message != '':
|
||||||
|
text = message
|
||||||
|
text+= '\nPour répondre, allez sur www.ernestophone.ens.fr/calendar/' + id + '/reponse'
|
||||||
|
text = MIMEText(text, 'plain')
|
||||||
|
msg.attach(text)
|
||||||
|
smtpObj.sendmail(sender, receivers, msg.as_string())
|
||||||
|
except:
|
||||||
|
erreur = "Une erreur est survenue, le mail n'a pas pu être envoyé."
|
||||||
else:
|
else:
|
||||||
form = EventForm()
|
form = EventForm()
|
||||||
|
|
||||||
return render(request, "calendrier/create.html", locals())
|
return render(request, "calendrier/create.html", locals())
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def reponse(request, id):
|
||||||
|
part = request.user.profile
|
||||||
|
ev = Event.objects.get(id=id)
|
||||||
|
if request.method == "POST":
|
||||||
|
form = ParticipantsForm(request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
try:
|
||||||
|
p = Participants.objects.get(event=ev, participant=part)
|
||||||
|
p.delete()
|
||||||
|
except Participants.DoesNotExist:
|
||||||
|
pass
|
||||||
|
obj = form.save(commit=False)
|
||||||
|
obj.event = ev
|
||||||
|
obj.participant = part
|
||||||
|
obj.save()
|
||||||
|
envoi = True
|
||||||
|
else:
|
||||||
|
form = ParticipantsForm()
|
||||||
|
return render(request, "calendrier/reponse.html", locals())
|
||||||
|
|
||||||
|
def repouidir(request, codeus, codeev):
|
||||||
|
part = ErnestoUser.objects.get(slug=codeus)
|
||||||
|
ev = Event.objects.get(slug=codeev)
|
||||||
|
try:
|
||||||
|
p = Participants.objects.get(event=ev, participant=part)
|
||||||
|
p.delete()
|
||||||
|
except Participants.DoesNotExist:
|
||||||
|
pass
|
||||||
|
obj = Participants()
|
||||||
|
obj.participant = part
|
||||||
|
obj.event = ev
|
||||||
|
obj.reponse="oui"
|
||||||
|
obj.save()
|
||||||
|
envoi = True
|
||||||
|
return render(request,"calendrier/home.html", locals())
|
||||||
|
|
||||||
|
|
||||||
|
def reppedir(request, codeus, codeev):
|
||||||
|
part = ErnestoUser.objects.get(slug=codeus)
|
||||||
|
ev = Event.objects.get(slug=codeev)
|
||||||
|
try:
|
||||||
|
p = Participants.objects.get(event=ev, participant=part)
|
||||||
|
p.delete()
|
||||||
|
except Participants.DoesNotExist:
|
||||||
|
pass
|
||||||
|
obj = Participants()
|
||||||
|
obj.participant = part
|
||||||
|
obj.event = ev
|
||||||
|
obj.reponse="pe"
|
||||||
|
obj.save()
|
||||||
|
envoi = True
|
||||||
|
return render(request,"calendrier/home.html", locals())
|
||||||
|
|
||||||
|
def repnondir(request, codeus, codeev):
|
||||||
|
part = ErnestoUser.objects.get(slug=codeus)
|
||||||
|
ev = Event.objects.get(slug=codeev)
|
||||||
|
try:
|
||||||
|
p = Participants.objects.get(event=ev, participant=part)
|
||||||
|
p.delete()
|
||||||
|
except Participants.DoesNotExist:
|
||||||
|
pass
|
||||||
|
obj = Participants()
|
||||||
|
obj.participant = part
|
||||||
|
obj.event = ev
|
||||||
|
obj.reponse="non"
|
||||||
|
obj.save()
|
||||||
|
envoi = True
|
||||||
|
return render(request,"calendrier/home.html", locals())
|
||||||
|
|
||||||
class EventUpdate(UpdateView):
|
class EventUpdate(UpdateView):
|
||||||
model = Event
|
model = Event
|
||||||
template_name = "calendrier/update.html"
|
template_name = "calendrier/update.html"
|
||||||
form_class = EventForm
|
form_class = EventForm
|
||||||
success_url = reverse_lazy(home)
|
success_url = reverse_lazy(home)
|
||||||
|
|
||||||
|
@method_decorator(chef_required)
|
||||||
|
def dispatch(self, *args, **kwargs):
|
||||||
|
return super(EventUpdate, self).dispatch(*args, **kwargs)
|
||||||
|
|
||||||
|
class EventDelete(DeleteView):
|
||||||
|
model = Event
|
||||||
|
template_name = "calendrier/delete.html"
|
||||||
|
success_url = reverse_lazy(home)
|
||||||
|
|
||||||
|
@method_decorator(chef_required)
|
||||||
|
def dispatch(self, *args, **kwargs):
|
||||||
|
return super(EventDelete, self).dispatch(*args, **kwargs)
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -3,6 +3,7 @@ from django.contrib.auth.models import User, Group
|
||||||
from gestion.models import ErnestoUser
|
from gestion.models import ErnestoUser
|
||||||
from django.contrib.auth.admin import UserAdmin
|
from django.contrib.auth.admin import UserAdmin
|
||||||
from calendrier.models import Event
|
from calendrier.models import Event
|
||||||
|
from propositions.models import Prop
|
||||||
|
|
||||||
class UserProfileInline(admin.StackedInline):
|
class UserProfileInline(admin.StackedInline):
|
||||||
model = ErnestoUser
|
model = ErnestoUser
|
||||||
|
@ -38,4 +39,5 @@ admin.site.unregister(User)
|
||||||
admin.site.unregister(Group)
|
admin.site.unregister(Group)
|
||||||
admin.site.register(User, UserProfileAdmin)
|
admin.site.register(User, UserProfileAdmin)
|
||||||
admin.site.register(Event)
|
admin.site.register(Event)
|
||||||
|
admin.site.register(Prop)
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
|
@ -9,12 +9,15 @@ class ErnestoUser(models.Model):
|
||||||
is_chef = models.BooleanField("Chef Fanfare", default=False)
|
is_chef = models.BooleanField("Chef Fanfare", default=False)
|
||||||
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
||||||
instru = models.CharField("Instrument joué", max_length=40, blank=True)
|
instru = models.CharField("Instrument joué", max_length=40, blank=True)
|
||||||
|
slug = models.CharField(max_length=7, editable=False, unique=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Profil Ernestophoniste"
|
verbose_name = "Profil Ernestophoniste"
|
||||||
verbose_name_plural = "Profils Ernestophonistes"
|
verbose_name_plural = "Profil Ernestophoniste"
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return unicode(self.user.username)
|
return unicode(self.user.username)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.user.username
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
|
@ -11,6 +11,7 @@ import smtplib
|
||||||
|
|
||||||
from gestion.forms import InscriptionMembreForm, RegistrationFormUser
|
from gestion.forms import InscriptionMembreForm, RegistrationFormUser
|
||||||
from gestion.models import ErnestoUser
|
from gestion.models import ErnestoUser
|
||||||
|
from propositions.utils import generer
|
||||||
|
|
||||||
from calendrier.views import calendar
|
from calendrier.views import calendar
|
||||||
|
|
||||||
|
@ -24,11 +25,20 @@ def inscription_membre(request):
|
||||||
if not (comp_form.cleaned_data['validation'] == "Pouet-ta-mere"):
|
if not (comp_form.cleaned_data['validation'] == "Pouet-ta-mere"):
|
||||||
error = "Le champ Validation ne correspond pas à celui attendu"
|
error = "Le champ Validation ne correspond pas à celui attendu"
|
||||||
return render(request, "gestion/registration.html", locals())
|
return render(request, "gestion/registration.html", locals())
|
||||||
member = user_form.save()
|
member = user_form.save(commit=False)
|
||||||
|
temp = True
|
||||||
|
while temp:
|
||||||
|
code = generer()
|
||||||
|
try:
|
||||||
|
ErnestoUser.objects.get(slug=code)
|
||||||
|
except:
|
||||||
|
temp=False
|
||||||
member.save()
|
member.save()
|
||||||
(profile, _) = ErnestoUser.objects.get_or_create(user = member)
|
(profile, _) = ErnestoUser.objects.get_or_create(user = member)
|
||||||
comp_form = InscriptionMembreForm(requbis, instance = profile)
|
comp_form = InscriptionMembreForm(requbis, instance = profile)
|
||||||
comp_form.save()
|
obj = comp_form.save(commit=False)
|
||||||
|
obj.slug=code
|
||||||
|
obj.save()
|
||||||
envoi = True
|
envoi = True
|
||||||
return render(request, 'gestion/thanks.html', locals())
|
return render(request, 'gestion/thanks.html', locals())
|
||||||
else:
|
else:
|
||||||
|
@ -53,6 +63,7 @@ def login(request):
|
||||||
pass
|
pass
|
||||||
return django_login_view(request, template_name = 'login.html', )
|
return django_login_view(request, template_name = 'login.html', )
|
||||||
|
|
||||||
|
def divers(request):
|
||||||
|
return render(request, "gestion/divers.html", locals())
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
0
propositions/__init__.py
Normal file
0
propositions/__init__.py
Normal file
BIN
propositions/__pycache__/__init__.cpython-34.pyc
Normal file
BIN
propositions/__pycache__/__init__.cpython-34.pyc
Normal file
Binary file not shown.
BIN
propositions/__pycache__/admin.cpython-34.pyc
Normal file
BIN
propositions/__pycache__/admin.cpython-34.pyc
Normal file
Binary file not shown.
BIN
propositions/__pycache__/forms.cpython-34.pyc
Normal file
BIN
propositions/__pycache__/forms.cpython-34.pyc
Normal file
Binary file not shown.
BIN
propositions/__pycache__/models.cpython-34.pyc
Normal file
BIN
propositions/__pycache__/models.cpython-34.pyc
Normal file
Binary file not shown.
BIN
propositions/__pycache__/urls.cpython-34.pyc
Normal file
BIN
propositions/__pycache__/urls.cpython-34.pyc
Normal file
Binary file not shown.
BIN
propositions/__pycache__/utils.cpython-34.pyc
Normal file
BIN
propositions/__pycache__/utils.cpython-34.pyc
Normal file
Binary file not shown.
BIN
propositions/__pycache__/views.cpython-34.pyc
Normal file
BIN
propositions/__pycache__/views.cpython-34.pyc
Normal file
Binary file not shown.
3
propositions/admin.py
Normal file
3
propositions/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
12
propositions/forms.py
Normal file
12
propositions/forms.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from django import forms
|
||||||
|
from propositions.models import Prop
|
||||||
|
|
||||||
|
class PropForm(forms.ModelForm):
|
||||||
|
class Meta:
|
||||||
|
model = Prop
|
||||||
|
fields = ('nom', 'artiste', 'lien')
|
||||||
|
widgets = {
|
||||||
|
'lien': forms.TextInput(attrs={"placeholder": "facultatif"}),
|
||||||
|
'nom': forms.TextInput(attrs={"placeholder": "Nom du morceau"}),
|
||||||
|
'artiste': forms.TextInput(attrs={"placeholder": "facultatif"}),
|
||||||
|
}
|
29
propositions/models.py
Normal file
29
propositions/models.py
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
from django.db import models
|
||||||
|
from gestion.models import ErnestoUser
|
||||||
|
|
||||||
|
REP = (
|
||||||
|
('oui', 'Oui'),
|
||||||
|
('non', 'Non'),
|
||||||
|
)
|
||||||
|
|
||||||
|
class Prop(models.Model):
|
||||||
|
nom = models.CharField(max_length=100)
|
||||||
|
artiste = models.CharField(blank=True, max_length=100)
|
||||||
|
user = models.ForeignKey(ErnestoUser, verbose_name="Proposé par")
|
||||||
|
lien = models.URLField(blank=True)
|
||||||
|
nboui = models.IntegerField(default=0, verbose_name="oui")
|
||||||
|
nbnon = models.IntegerField(default=0, verbose_name="non")
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.nom
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name="Proposition"
|
||||||
|
|
||||||
|
class Reponses(models.Model):
|
||||||
|
prop = models.ForeignKey(Prop)
|
||||||
|
part = models.ForeignKey(ErnestoUser)
|
||||||
|
reponse = models.CharField("Réponse", max_length=20, blank=True, choices=REP)
|
||||||
|
|
||||||
|
# Create your models here.
|
||||||
|
|
BIN
propositions/templatetags/__pycache__/getresponse.cpython-34.pyc
Normal file
BIN
propositions/templatetags/__pycache__/getresponse.cpython-34.pyc
Normal file
Binary file not shown.
12
propositions/templatetags/getresponse.py
Normal file
12
propositions/templatetags/getresponse.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from django import template
|
||||||
|
from propositions.models import Reponses
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
@register.inclusion_tag("propositions/reponse.html")
|
||||||
|
def getresponse(user, prop):
|
||||||
|
try:
|
||||||
|
rep = Reponses.objects.get(prop=prop, part=user)
|
||||||
|
return {"reponse": rep.reponse}
|
||||||
|
except Reponses.DoesNotExist:
|
||||||
|
return {}
|
3
propositions/tests.py
Normal file
3
propositions/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
10
propositions/urls.py
Normal file
10
propositions/urls.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from django.conf.urls import patterns, url
|
||||||
|
from propositions.views import PropDelete
|
||||||
|
|
||||||
|
urlpatterns = patterns('propositions.views',
|
||||||
|
url(r'^$', 'liste'),
|
||||||
|
url(r'^new/?$', 'create_prop'),
|
||||||
|
url(r'^(?P<id>\d+)/oui/?$', 'repoui'),
|
||||||
|
url(r'^(?P<id>\d+)/non/?$', 'repnon'),
|
||||||
|
url(r'^(?P<pk>\d+)/supprimer/?$', PropDelete.as_view()),
|
||||||
|
)
|
7
propositions/utils.py
Normal file
7
propositions/utils.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import string
|
||||||
|
import random
|
||||||
|
|
||||||
|
def generer(*args):
|
||||||
|
caracteres = string.ascii_letters + string.digits
|
||||||
|
aleatoire = [random.choice(caracteres) for _ in range(6)]
|
||||||
|
return ''.join(aleatoire)
|
101
propositions/views.py
Normal file
101
propositions/views.py
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
from django.shortcuts import render, redirect
|
||||||
|
from django.core.urlresolvers import reverse_lazy
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.views.generic import DeleteView
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
|
||||||
|
import string
|
||||||
|
import random
|
||||||
|
|
||||||
|
from propositions.forms import PropForm
|
||||||
|
from propositions.models import Prop
|
||||||
|
from propositions.models import Reponses
|
||||||
|
from propositions.utils import generer
|
||||||
|
from gestion.models import ErnestoUser
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def create_prop(request):
|
||||||
|
if request.method == "POST":
|
||||||
|
form = PropForm(request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
obj = form.save(commit=False)
|
||||||
|
obj.nboui = 0
|
||||||
|
obj.nbnon = 0
|
||||||
|
obj.user = request.user.profile
|
||||||
|
obj.save()
|
||||||
|
envoi = True
|
||||||
|
else:
|
||||||
|
form = PropForm()
|
||||||
|
return render(request, "propositions/create.html", locals())
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def liste(request):
|
||||||
|
props = Prop.objects.all().order_by('-nboui', 'nbnon', 'nom')
|
||||||
|
n = len(props)
|
||||||
|
return render(request, 'propositions/liste.html', locals())
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def repoui(request, id):
|
||||||
|
prop = Prop.objects.get(id=id)
|
||||||
|
participant = request.user.profile
|
||||||
|
try:
|
||||||
|
p = Reponses.objects.get(prop=prop, part=participant)
|
||||||
|
if p.reponse == "oui":
|
||||||
|
prop.nboui -= 1
|
||||||
|
else:
|
||||||
|
prop.nbnon-=1
|
||||||
|
p.delete()
|
||||||
|
except Reponses.DoesNotExist:
|
||||||
|
pass
|
||||||
|
rep = Reponses()
|
||||||
|
rep.prop = prop
|
||||||
|
rep.part = participant
|
||||||
|
rep.reponse = "oui"
|
||||||
|
rep.save()
|
||||||
|
prop.nboui += 1
|
||||||
|
prop.save()
|
||||||
|
return redirect('propositions.views.liste')
|
||||||
|
|
||||||
|
class PropDelete(DeleteView):
|
||||||
|
model = Prop
|
||||||
|
template_name= "propositions/delete.html"
|
||||||
|
success_url = reverse_lazy(liste)
|
||||||
|
|
||||||
|
@method_decorator(login_required)
|
||||||
|
def dispatch(self, *args, **kwargs):
|
||||||
|
return super(PropDelete, self).dispatch(*args, **kwargs)
|
||||||
|
|
||||||
|
def delete(self, request, *args, **kwargs):
|
||||||
|
self.object = self.get_object()
|
||||||
|
success_url = self.get_success_url()
|
||||||
|
if not ((self.object.user == self.request.user.profile) or self.request.user.profile.is_chef):
|
||||||
|
return redirect('propositions.views.liste')
|
||||||
|
else:
|
||||||
|
self.object.delete()
|
||||||
|
return HttpResponseRedirect(success_url)
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def repnon(request, id):
|
||||||
|
prop = Prop.objects.get(id=id)
|
||||||
|
participant = request.user.profile
|
||||||
|
try:
|
||||||
|
p = Reponses.objects.get(prop=prop, part=participant)
|
||||||
|
if p.reponse == "oui":
|
||||||
|
prop.nboui -= 1
|
||||||
|
else:
|
||||||
|
prop.nbnon -= 1
|
||||||
|
p.delete()
|
||||||
|
except Reponses.DoesNotExist:
|
||||||
|
pass
|
||||||
|
rep = Reponses()
|
||||||
|
rep.prop = prop
|
||||||
|
rep.part = participant
|
||||||
|
rep.reponse = "non"
|
||||||
|
rep.save()
|
||||||
|
prop.nbnon += 1
|
||||||
|
prop.save()
|
||||||
|
return redirect('propositions.views.liste')
|
||||||
|
|
||||||
|
# Create your views here.
|
BIN
static/Favicon.ico
Normal file
BIN
static/Favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
BIN
static/FondErnesto.gif
Normal file
BIN
static/FondErnesto.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
149
static/css/ernesto.css
Normal file
149
static/css/ernesto.css
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
@import url("http://fonts.googleapis.com/css?family=Lobster");
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font: 36px Lobster;
|
||||||
|
margin-bottom: 0.8em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #e4522f;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: none repeat scroll 0% 0% #45312D;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.oui {
|
||||||
|
background-color: #409526;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.pe {
|
||||||
|
background-color: #E68200;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.non {
|
||||||
|
background-color: #C30909;
|
||||||
|
}
|
||||||
|
|
||||||
|
#page {
|
||||||
|
background: none repeat scroll 0% 0% #ffffff;
|
||||||
|
min-height: 100%;
|
||||||
|
margin: 0px auto;
|
||||||
|
max-width: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#page section {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
background: none repeat scroll 0% 0% #e4522f;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu {
|
||||||
|
list-style-type: none;
|
||||||
|
max-width: 85%;
|
||||||
|
padding: 0px;
|
||||||
|
text-align: right;
|
||||||
|
margin-bottom:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu li {
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 1.2em;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu a {
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu li > * {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 30px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu a:hover {
|
||||||
|
background: none repeat scroll 0% 0% #ffffff;
|
||||||
|
color: #e4522f;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo_ernesto {
|
||||||
|
float: left;
|
||||||
|
width: 15%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo_ernesto img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#menu {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
width: 230px;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea, input {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
form p {
|
||||||
|
border-top: 1px solid #f7e4e0;
|
||||||
|
padding-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fichier, .telecharger, .supprimer {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 3px;
|
||||||
|
padding: 2px 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.telecharger:hover, .supprimer:hover {
|
||||||
|
color: #ffffff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fichier {
|
||||||
|
color: #1d90d2;
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.supprimer {
|
||||||
|
border: 1px solid #cc0000;
|
||||||
|
color: #cc0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.supprimer:hover {
|
||||||
|
background: none repeat scroll 0% 0% #cc0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.telecharger:hover {
|
||||||
|
background: none repeat scroll 0% 0% #6cb828;
|
||||||
|
}
|
||||||
|
|
||||||
|
.telecharger {
|
||||||
|
border: 1px solid #6cb828;
|
||||||
|
color: #6cb828;
|
||||||
|
}
|
|
@ -20,3 +20,4 @@ header li
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
static/logo.png
Normal file
BIN
static/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
|
@ -3,11 +3,14 @@
|
||||||
{% block titre%}Création d'Évènement{% endblock %}
|
{% block titre%}Création d'Évènement{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if envoi %}Votre message a bien été envoyé !{% endif %}
|
{% if envoi %}L'événement a bien été créé !{% endif %}
|
||||||
|
<br>
|
||||||
|
{% if erreur %}
|
||||||
|
{{ erreur }}
|
||||||
|
{% endif %}
|
||||||
<form action="{% url 'calendrier.views.create_event' %}" method="post">
|
<form action="{% url 'calendrier.views.create_event' %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{{ form.as_p }}
|
||||||
<input type="submit" value="Submit" />
|
<input type="submit" value="Enregistrer" />
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
10
templates/calendrier/delete.html
Normal file
10
templates/calendrier/delete.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block titre %}Suppression d'un événement{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}<form action="" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<p>Voulez vous vraiment supprimer l'événement {{ object }}?</p>
|
||||||
|
<input type="submit" value="Oui" />
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
|
@ -11,6 +11,14 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>L'Ernestophone, la fanfare de l'École normale supérieure</h1>
|
<h1>L'Ernestophone, la fanfare de l'École normale supérieure</h1>
|
||||||
|
<div id="description">
|
||||||
|
<p>
|
||||||
|
Fanfaron de passage, musicien intrigué, Ernestophoniste en quête de sensations fortes ou de partitions, ou tout simplement internaute égaré, l'Ernestophone te souhaite la bienvenue sur son son site !
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
L'Ernestophone, c'est la fanfare de l'École normale supérieure, (re)créée en septembre 2011, pour le plus grand bonheur des petits. Et des grands.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td width="20%" align="left">
|
<td width="20%" align="left">
|
||||||
|
|
17
templates/calendrier/reponse.html
Normal file
17
templates/calendrier/reponse.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block titre %}Participation à un événement{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% if envoi %}<p>Votre réponse a été enregistrée !</p>{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
<p><a href="{% url 'calendrier.views.view_eventbis' id %}">Retour à l'événement</a></p>
|
||||||
|
<div> Voulez vous participer à l'événement {{ ev.nom }}, le {{ ev.date }} à {{ ev.debut|time:"H:i" }} ?</div>
|
||||||
|
|
||||||
|
<form action="{% url 'calendrier.views.reponse' id %}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<input type="submit" value="Valider" />
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
|
@ -3,8 +3,13 @@
|
||||||
{% block titre %}{{ nom }}{% endblock %}
|
{% block titre %}{{ nom }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<div id="viewevent">
|
||||||
{% if user.profile.is_chef %}
|
{% if user.profile.is_chef %}
|
||||||
<p><a href="/calendar/edition/{{ev.id}}">Modifier l'événement</a></p>
|
<p><a href="/calendar/edition/{{ev.id}}">Modifier l'événement</a></p>
|
||||||
|
<p><a href="/calendar/supprimer/{{ev.id}}">Supprimer l'événement</a></p>
|
||||||
|
{% endif %}
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<p><a href="{% url 'calendrier.views.reponse' id %}">Répondre à l'événement</a></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p>{{ nom }}</p>
|
<p>{{ nom }}</p>
|
||||||
<p>{{ev.date}}</p>
|
<p>{{ev.date}}</p>
|
||||||
|
@ -17,5 +22,30 @@
|
||||||
{% if desc %}
|
{% if desc %}
|
||||||
<p>{{ev.description }}</p>
|
<p>{{ev.description }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<div id="doodle">
|
||||||
|
<h4>Participants</h4>
|
||||||
|
<p><b>{{ nboui }}</b> ont répondu oui, <b>{{ nbpe }}</b> peut-être, et <b>{{ nbnon }}</b> non</p>
|
||||||
|
<table>
|
||||||
|
{% if part %}<tr>
|
||||||
|
<th>Ernestophoniste</th>
|
||||||
|
<th>Réponse</th>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% for p in part %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ p.participant.user.username }}</td>
|
||||||
|
{% if p.reponse == "oui" %}<td class="oui"></td>
|
||||||
|
{% elif p.reponse == "pe" %}<td class="pe"></td>
|
||||||
|
{% elif p.reponse == "non" %}<td class="non"></td>
|
||||||
|
{% else %}<td></td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
Pas de réponse pour l'instant
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -7,28 +7,38 @@
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>{% block titre %}{% endblock %}</title>
|
<title>{% block titre %}{% endblock %}</title>
|
||||||
<link rel="stylesheet" href={% static 'css/bootstrap.css' %} />
|
<link rel="stylesheet" href={% static 'css/bootstrap.css' %} />
|
||||||
<link rel="stylesheet" href={% static 'css/main.css' %} />
|
<link rel="stylesheet" href={% static 'css/ernesto.css' %} />
|
||||||
{% block extrahead %}{% endblock %}
|
{% block extrahead %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div id="page">
|
||||||
<header>
|
<header>
|
||||||
{% block header %}
|
{% block header %}
|
||||||
<ul id="menu">
|
<div id="logo_ernesto">
|
||||||
<li><a href = '/'>Accueil</a></li>
|
<a href='/'><img src="{%static "logo.png" %}" alt="L'Ernestophone" /></a>
|
||||||
{% if user.is_authenticated %}
|
</div>
|
||||||
<li>Vous êtes connecté en tant que {{user.username }}</li>
|
|
||||||
<li><a href = '/logout/'>Déconnexion</a></li>
|
<nav>
|
||||||
{% if user.profile.is_chef %}
|
<ul id="menu">
|
||||||
<li><a href = '/admin/'>Administration</a></li>
|
<li><a href="{% url 'partitions.views.liste' %}">Partitions</a></li>
|
||||||
{% endif %}
|
{% if user.is_authenticated %}
|
||||||
{% else %}
|
{% if user.profile.is_chef %}
|
||||||
<li><a href='/login/'>Connexion</a></li>
|
<li><a href = '/admin/'>Administration</a></li>
|
||||||
<li><a href='/registration/'>Créer un compte</a></li>
|
{% endif %}
|
||||||
{% endif %}
|
<li><a href='/divers/'>Divers</a></li>
|
||||||
<li><a href="{% url "partitions.views.liste" %}">Partitions</a></li>
|
<li>Connecté en tant que {{user.username }}</li>
|
||||||
</ul>
|
<li><a href = '/logout/'>Déconnexion</a></li>
|
||||||
|
{% else %}
|
||||||
|
<li><a href='/login/'>Connexion</a></li>
|
||||||
|
<li><a href='/registration/'>Créer un compte</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
{% endblock %}</header>
|
{% endblock %}</header>
|
||||||
|
<section id="content">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
8
templates/gestion/divers.html
Normal file
8
templates/gestion/divers.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block titre %}Divers{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<h1>Divers</h1>
|
||||||
|
<ul>
|
||||||
|
<li><a href="{% url "propositions.views.liste" %}">Propositions de morceaux</a></li>
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
|
@ -2,6 +2,7 @@
|
||||||
{% block titre %}Connexion{% endblock %}
|
{% block titre %}Connexion{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Connexion</h1>
|
<h1>Connexion</h1>
|
||||||
|
<div id="Connexion">
|
||||||
{% if form.errors %}
|
{% if form.errors %}
|
||||||
<p>Mot de passe ou nom d'utilisateur incorrect</p>
|
<p>Mot de passe ou nom d'utilisateur incorrect</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -12,16 +13,18 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ form.username }}</td>
|
<td><input type="{{ form.username.type }}" name="login" placeholder="Login"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ form.password }}</td>
|
<td><input type="password" name="{{ form.password.name }}" placeholder="Password"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<input type="submit" value="Connexion" />
|
<input type="submit" value="Connexion" />
|
||||||
|
</form>
|
||||||
{% if next %}
|
{% if next %}
|
||||||
<input type="hidden" name="next" value={{ next }} />
|
<input type="hidden" name="next" value={{ next }} />
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="hidden" name="next" value="/" />
|
<input type="hidden" name="next" value="/" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,16 +4,22 @@
|
||||||
{% if suppression %}
|
{% if suppression %}
|
||||||
<p>{{ suppression }}</p>
|
<p>{{ suppression }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if user.is_authenticated %}
|
||||||
<h3><a href="{% url "partitions.views.ajouter_morceau" %}">Ajouter un morceau</a></h3>
|
<h3><a href="{% url "partitions.views.ajouter_morceau" %}">Ajouter un morceau</a></h3>
|
||||||
|
{% endif %}
|
||||||
|
<ul class="filelist">
|
||||||
{% for part in partitions %}
|
{% for part in partitions %}
|
||||||
|
<li>
|
||||||
{% if not user.is_authenticated %}
|
{% if not user.is_authenticated %}
|
||||||
<p>{{ part.nom }} - {{ part.auteur }}</p>
|
{{ part.nom }} - {{ part.auteur }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<p><a href="{% url "partitions.views.listepart" part.nom part.auteur %}">{{ part.nom }} - {{ part.auteur }}</a></p>
|
<a href="{% url "partitions.views.listepart" part.nom part.auteur %}" class="fichier">{{ part.nom }} - {{ part.auteur }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.profile.is_chef %}
|
{% if user.profile.is_chef %}
|
||||||
<p><a href="{% url "partitions.views.conf_delete_morc" part.nom part.auteur %}">Supprimer</a></p>
|
<a href="{% url "partitions.views.conf_delete_morc" part.nom part.auteur %}" class="supprimer">Supprimer</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -6,19 +6,22 @@
|
||||||
{% if suppression %}
|
{% if suppression %}
|
||||||
<p>{{ suppression }}</p>
|
<p>{{ suppression }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<ul class="filelist">
|
||||||
{% for p in part %}
|
{% for p in part %}
|
||||||
{% if user.is_authenticated and ".pdf" in p.part.url %}
|
{% if user.is_authenticated and ".pdf" in p.part.url %}
|
||||||
<p><a href="{% url "partitions.views.see" nom auteur p.part.url|cuturl %}">{{ p.nom }}</a>
|
<li><a href="{% url "partitions.views.see" nom auteur p.part.url|cuturl %}" class="fichier">{{ p.nom }}</a>
|
||||||
{% elif user.is_authenticated and ".mp3" in p.part.url %}
|
{% elif user.is_authenticated and ".mp3" in p.part.url %}
|
||||||
<p><a href="{% url "partitions.views.see" nom auteur p.part.url|cuturl %}">{{ p.nom }}</a>
|
<li><a href="{% url "partitions.views.see" nom auteur p.part.url|cuturl %}" class="fichier">{{ p.nom }}</a>
|
||||||
{% else %}<p>{{ p.nom }}
|
{% else %}<li>{{ p.nom }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.is_authenticated %}<a href="{% url "partitions.views.download" nom auteur p.part.url|cuturl %}">Télécharger</a>{% endif %} </p>
|
{% if user.is_authenticated %}<a href="{% url "partitions.views.download" nom auteur p.part.url|cuturl %}" class="telecharger">Télécharger</a>{% endif %}
|
||||||
{% if user.profile.is_chef %}
|
{% if user.profile.is_chef %}
|
||||||
<p><a href="{% url "partitions.views.conf_delete" nom auteur p.pk %}">Supprimer</a> </p>
|
<a href="{% url "partitions.views.conf_delete" nom auteur p.pk %}" class="supprimer">Supprimer</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</li>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<p> Pas de partitions pour le moment </p>
|
<p> Pas de partitions pour le moment </p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
<p><a href="{% url "partitions.views.upload" p.nom p.auteur %}">Ajouter un média</a></p>
|
<p><a href="{% url "partitions.views.upload" p.nom p.auteur %}">Ajouter un média</a></p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
13
templates/propositions/create.html
Normal file
13
templates/propositions/create.html
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{%block titre %}Proposition de morceau{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<p><a href="{% url "propositions.views.liste" %}">Retour aux propositions</a></p>
|
||||||
|
{% if envoi %}<p>Votre proposition a été enregistrée.{% endif %}
|
||||||
|
<form action="{% url 'propositions.views.create_prop' %}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<input type="submit" value="Enregistrer" />
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
10
templates/propositions/delete.html
Normal file
10
templates/propositions/delete.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block titre %}Suppression d'une proposition{% endblock %}
|
||||||
|
{% block content %}<form action="" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<p><a href="{% url "propositions.views.liste" %}">Retour aux propositions</a></p>
|
||||||
|
<p>Voulez vous vraiment supprimer la proposition {{ object }}?</p>
|
||||||
|
<input type="submit" value="Oui" />
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
22
templates/propositions/liste.html
Normal file
22
templates/propositions/liste.html
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% load getresponse %}
|
||||||
|
{% block titre %}Propositions de morceau{% endblock %}
|
||||||
|
{% block content %}<h1>Liste des propositions</h1>
|
||||||
|
{% if error %}
|
||||||
|
<p>{{ error }}</p>
|
||||||
|
{% endif %}
|
||||||
|
<p><a href="{% url "propositions.views.create_prop" %}">Proposer un morceau</a></p>
|
||||||
|
{% if n > 0 %}
|
||||||
|
<table>
|
||||||
|
<tr><th></th><th>Oui</th><th>Non</th><th></th><th></th><th></th></tr>
|
||||||
|
{% for p in props %}
|
||||||
|
<tr><td>{% if p.lien %}<a href={{p.lien}}>{% endif %}<b>{{ p.nom }}</b>{% if p.artiste %} - {{ p.artiste }}{% endif %}{% if p.lien %}</a>{% endif %}</td>
|
||||||
|
<td>{{p.nboui }}</td><td>{{ p.nbnon }}</td><td><a href="{% url "propositions.views.repoui" p.id %}">Oui</a></td><td><a href="{% url "propositions.views.repnon" p.id %}">Non</a></td>
|
||||||
|
{% getresponse request.user.profile p %}<td>{% if p.user == request.user.profile or request.user.profile.is_chef %}<a href=/propositions/{{p.id}}/supprimer/>Supprimer</a>{% endif %}</td></tr>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
Pas de proposition pour le moment
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
1
templates/propositions/reponse.html
Normal file
1
templates/propositions/reponse.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<td>{% if reponse %}Vous avez voté {{ reponse }}{%endif%}</td>
|
5
templates/propositions/voteok.html
Normal file
5
templates/propositions/voteok.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block titre %}Vote pris en compte{% endblock %}
|
||||||
|
{% block content %}<p>Votre vote a été pris en compte</p>
|
||||||
|
<p><a href="{% url "propositions.views.liste" %}">Voir la liste des propositions</a></p>{% endblock %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue