forked from DGNum/gestioCOF
Merge branch 'Kerl/django111-packages' into 'supportBDS'
Upgrade to Django 1.11 - We upgrade our django packages to 1.11 (beta 1) - We apply some necessary changes in the settings file - We prepare to upgrade Django-autocomplete-light - We upgrade some other packages See merge request !179
This commit is contained in:
commit
0e4cfc5121
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import autocomplete_light
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from custommail.shortcuts import send_mass_custom_mail
|
from custommail.shortcuts import send_mass_custom_mail
|
||||||
|
|
||||||
|
@ -119,8 +118,6 @@ class AttributionAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
class ChoixSpectacleAdmin(admin.ModelAdmin):
|
class ChoixSpectacleAdmin(admin.ModelAdmin):
|
||||||
form = autocomplete_light.modelform_factory(ChoixSpectacle, exclude=[])
|
|
||||||
|
|
||||||
def tirage(self, obj):
|
def tirage(self, obj):
|
||||||
return obj.participant.tirage
|
return obj.participant.tirage
|
||||||
list_display = ("participant", "tirage", "spectacle", "priority",
|
list_display = ("participant", "tirage", "spectacle", "priority",
|
||||||
|
|
6
bda/apps.py
Normal file
6
bda/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class BdAConfig(AppConfig):
|
||||||
|
name = "bda"
|
||||||
|
verbose_name = "Gestion des tirages du BdA"
|
|
@ -1,18 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import autocomplete_light
|
|
||||||
|
|
||||||
from bda.models import Participant, Spectacle
|
|
||||||
|
|
||||||
autocomplete_light.register(
|
|
||||||
Participant, search_fields=('user__username', 'user__first_name',
|
|
||||||
'user__last_name'),
|
|
||||||
autocomplete_js_attributes={'placeholder': 'participant...'})
|
|
||||||
|
|
||||||
autocomplete_light.register(
|
|
||||||
Spectacle, search_fields=('title', ),
|
|
||||||
autocomplete_js_attributes={'placeholder': 'spectacle...'})
|
|
6
bds/apps.py
Normal file
6
bds/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class BDSConfig(AppConfig):
|
||||||
|
name = "bds"
|
||||||
|
verbose_name = "Application de gestion du BDS"
|
|
@ -1,33 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.contrib.auth.models import Group, Permission
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
def create_groups(apps, schema_editor):
|
def create_groups(apps, schema_editor):
|
||||||
from django.contrib.auth.management import create_permissions
|
"""
|
||||||
|
Creates the groups for BDS members and staff
|
||||||
apps.models_module = True
|
"""
|
||||||
create_permissions(apps, verbosity=0)
|
Group = apps.get_model("auth", "Group")
|
||||||
apps.models_module = None
|
Group.objects.get_or_create(name="bds_members")
|
||||||
|
Group.objects.get_or_create(name="bds_buro")
|
||||||
memberp = Permission.objects.get(
|
|
||||||
codename="member",
|
|
||||||
content_type__app_label="bds"
|
|
||||||
)
|
|
||||||
burop = Permission.objects.get(
|
|
||||||
codename="buro",
|
|
||||||
content_type__app_label="bds"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Creates the groups for BDS members and staff
|
|
||||||
member = Group.objects.create(name="bds_members")
|
|
||||||
buro = Group.objects.create(name="bds_buro")
|
|
||||||
|
|
||||||
# Associates the permissions to the respective groups
|
|
||||||
member.permissions = [memberp]
|
|
||||||
buro.permissions = [memberp, burop]
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -5,8 +5,6 @@ from django.core.urlresolvers import reverse
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
import django.utils.six as six
|
import django.utils.six as six
|
||||||
|
|
||||||
import autocomplete_light
|
|
||||||
|
|
||||||
from .petits_cours_models import PetitCoursDemande, \
|
from .petits_cours_models import PetitCoursDemande, \
|
||||||
PetitCoursSubject, PetitCoursAbility, PetitCoursAttribution, \
|
PetitCoursSubject, PetitCoursAbility, PetitCoursAttribution, \
|
||||||
PetitCoursAttributionCounter
|
PetitCoursAttributionCounter
|
||||||
|
@ -94,7 +92,6 @@ class EventAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
class EventRegistrationAdmin(admin.ModelAdmin):
|
class EventRegistrationAdmin(admin.ModelAdmin):
|
||||||
form = autocomplete_light.modelform_factory(EventRegistration, exclude=[])
|
|
||||||
list_display = ('__unicode__' if six.PY2 else '__str__', 'event', 'user',
|
list_display = ('__unicode__' if six.PY2 else '__str__', 'event', 'user',
|
||||||
'paid')
|
'paid')
|
||||||
list_filter = ('paid',)
|
list_filter = ('paid',)
|
||||||
|
|
6
cof/apps.py
Normal file
6
cof/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class COFConfig(AppConfig):
|
||||||
|
name = "cof"
|
||||||
|
verbose_name = "Application de gestion du COF"
|
|
@ -1,10 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
import autocomplete_light
|
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
|
||||||
autocomplete_light.register(
|
|
||||||
User, search_fields=('username', 'first_name', 'last_name'),
|
|
||||||
attrs={'placeholder': 'membre...'}
|
|
||||||
)
|
|
14
cof/forms.py
14
cof/forms.py
|
@ -12,8 +12,7 @@ from django.forms.formsets import BaseFormSet, formset_factory
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.core.validators import MinLengthValidator
|
from django.core.validators import MinLengthValidator
|
||||||
|
|
||||||
from .models import CofProfile, EventCommentValue, \
|
from .models import CofProfile, EventCommentValue, CalendarSubscription
|
||||||
CalendarSubscription, Club
|
|
||||||
from .widgets import TriStateCheckbox
|
from .widgets import TriStateCheckbox
|
||||||
|
|
||||||
from gestion.models import Profile
|
from gestion.models import Profile
|
||||||
|
@ -368,14 +367,3 @@ class CalendarForm(forms.ModelForm):
|
||||||
model = CalendarSubscription
|
model = CalendarSubscription
|
||||||
fields = ['subscribe_to_events', 'subscribe_to_my_shows',
|
fields = ['subscribe_to_events', 'subscribe_to_my_shows',
|
||||||
'other_shows']
|
'other_shows']
|
||||||
|
|
||||||
|
|
||||||
class ClubsForm(forms.Form):
|
|
||||||
"""
|
|
||||||
Formulaire d'inscription d'un membre à plusieurs clubs du COF.
|
|
||||||
"""
|
|
||||||
clubs = forms.ModelMultipleChoiceField(
|
|
||||||
label="Inscriptions aux clubs du COF",
|
|
||||||
queryset=Club.objects.all(),
|
|
||||||
widget=forms.CheckboxSelectMultiple,
|
|
||||||
required=False)
|
|
||||||
|
|
|
@ -72,7 +72,6 @@
|
||||||
<li><a href="{% url "admin:index" %}">Administration générale</a></li>
|
<li><a href="{% url "admin:index" %}">Administration générale</a></li>
|
||||||
<li><a href="{% url "petits-cours-demandes-list" %}">Demandes de petits cours</a></li>
|
<li><a href="{% url "petits-cours-demandes-list" %}">Demandes de petits cours</a></li>
|
||||||
<li><a href="{% url "registration" %}">Inscription d'un nouveau membre</a></li>
|
<li><a href="{% url "registration" %}">Inscription d'un nouveau membre</a></li>
|
||||||
<li><a href="{% url "liste-clubs" %}">Gestion des clubs</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<h4>Évènements & Sondages</h4>
|
<h4>Évènements & Sondages</h4>
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
{% extends "base_title.html" %}
|
|
||||||
|
|
||||||
{% block page_size %}col-sm-8{% endblock %}
|
|
||||||
|
|
||||||
{% block realcontent %}
|
|
||||||
<h2>Clubs enregistrés sur GestioCOF</h2>
|
|
||||||
<ul>
|
|
||||||
{% for club in owned_clubs %}
|
|
||||||
<li>
|
|
||||||
<a href="{% url "membres-club" club.name %}">
|
|
||||||
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}, {% empty %}pas de respo{% endfor %})
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
{% if other_clubs %}
|
|
||||||
{% for club in other_clubs %}
|
|
||||||
<li>
|
|
||||||
<p>
|
|
||||||
{{ club }} ({% for respo in club.respos.all %}{{ respo.get_full_name }}, {% empty %}pas de respo{% endfor %})
|
|
||||||
</p>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
|
@ -1,41 +0,0 @@
|
||||||
{% extends "base_title.html" %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block realcontent %}
|
|
||||||
<h2>{{ club }}</h2>
|
|
||||||
|
|
||||||
|
|
||||||
{% if club.respos.exists %}
|
|
||||||
<h3>Respo{{ club.respos.all|pluralize }}</h3>
|
|
||||||
<table class="table table-striped">
|
|
||||||
{% for member in club.respos.all %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ member }}</td>
|
|
||||||
<td>{{ member.email }}</td>
|
|
||||||
<td><a class="glyphicon glyphicon-arrow-down"
|
|
||||||
href="{% url "change-respo" club.name member.id %}"></a></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<h3>Pas de respo</h3>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{% if club.membres.exists %}
|
|
||||||
<h3>Liste des membres</h3>
|
|
||||||
<table class="table table-striped">
|
|
||||||
{% for member in members_no_respo %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ member }}</td>
|
|
||||||
<td>{{ member.email }}</td>
|
|
||||||
<td><a class="glyphicon glyphicon-arrow-up"
|
|
||||||
href="{% url "change-respo" club.name member.id %}"></a></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
Ce club ne comporte actuellement aucun membre.
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
|
@ -16,7 +16,6 @@
|
||||||
<hr />
|
<hr />
|
||||||
<table>
|
<table>
|
||||||
{{ cofprofile_form | bootstrap }}
|
{{ cofprofile_form | bootstrap }}
|
||||||
{{ clubs_form | bootstrap }}
|
|
||||||
</table>
|
</table>
|
||||||
{{ event_formset.management_form }}
|
{{ event_formset.management_form }}
|
||||||
{% for event_form in event_formset %}
|
{% for event_form in event_formset %}
|
||||||
|
|
|
@ -70,10 +70,3 @@ calendar_patterns = [
|
||||||
views.calendar_ics,
|
views.calendar_ics,
|
||||||
name="calendar.ics")
|
name="calendar.ics")
|
||||||
]
|
]
|
||||||
|
|
||||||
clubs_patterns = [
|
|
||||||
url(r'^membres/(?P<name>\w+)', views.membres_club, name='membres-club'),
|
|
||||||
url(r'^liste', views.liste_clubs, name='liste-clubs'),
|
|
||||||
url(r'^change_respo/(?P<club_name>\w+)/(?P<user_id>\d+)',
|
|
||||||
views.change_respo, name='change-respo'),
|
|
||||||
]
|
|
||||||
|
|
71
cof/views.py
71
cof/views.py
|
@ -6,8 +6,8 @@ from datetime import timedelta
|
||||||
from icalendar import Calendar, Event as Vevent
|
from icalendar import Calendar, Event as Vevent
|
||||||
from custommail.shortcuts import send_custom_mail
|
from custommail.shortcuts import send_custom_mail
|
||||||
|
|
||||||
from django.shortcuts import redirect, get_object_or_404, render
|
from django.shortcuts import get_object_or_404, render
|
||||||
from django.http import Http404, HttpResponse, HttpResponseForbidden
|
from django.http import Http404, HttpResponse
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
|
@ -21,12 +21,12 @@ from .models import Event, EventRegistration, EventOption, \
|
||||||
EventOptionChoice
|
EventOptionChoice
|
||||||
from .models import EventCommentField, EventCommentValue, \
|
from .models import EventCommentField, EventCommentValue, \
|
||||||
CalendarSubscription
|
CalendarSubscription
|
||||||
from .models import CofProfile, Club
|
from .models import CofProfile
|
||||||
from .decorators import buro_required, cof_required
|
from .decorators import buro_required, cof_required
|
||||||
from .forms import (
|
from .forms import (
|
||||||
EventStatusFilterForm, SurveyForm, SurveyStatusFilterForm,
|
EventStatusFilterForm, SurveyForm, SurveyStatusFilterForm,
|
||||||
RegistrationUserForm, RegistrationProfileForm, RegistrationCofProfileForm,
|
RegistrationUserForm, RegistrationProfileForm, RegistrationCofProfileForm,
|
||||||
EventForm, CalendarForm, EventFormset, RegistrationPassUserForm, ClubsForm
|
EventForm, CalendarForm, EventFormset, RegistrationPassUserForm
|
||||||
)
|
)
|
||||||
|
|
||||||
from bda.models import Tirage, Spectacle
|
from bda.models import Tirage, Spectacle
|
||||||
|
@ -305,9 +305,8 @@ def registration_form2(request, login_clipper=None, username=None,
|
||||||
# COF - profile
|
# COF - profile
|
||||||
cofprofile_form = RegistrationCofProfileForm()
|
cofprofile_form = RegistrationCofProfileForm()
|
||||||
registration_set_ro_fields(user_form, profile_form)
|
registration_set_ro_fields(user_form, profile_form)
|
||||||
# events & clubs
|
# events
|
||||||
event_formset = EventFormset(events=events, prefix='events')
|
event_formset = EventFormset(events=events, prefix='events')
|
||||||
clubs_form = ClubsForm()
|
|
||||||
if username:
|
if username:
|
||||||
member = get_object_or_404(User, username=username)
|
member = get_object_or_404(User, username=username)
|
||||||
(profile, _) = Profile.objects.get_or_create(user=member)
|
(profile, _) = Profile.objects.get_or_create(user=member)
|
||||||
|
@ -328,8 +327,6 @@ def registration_form2(request, login_clipper=None, username=None,
|
||||||
event_formset = EventFormset(
|
event_formset = EventFormset(
|
||||||
events=events, prefix='events',
|
events=events, prefix='events',
|
||||||
current_registrations=current_registrations)
|
current_registrations=current_registrations)
|
||||||
# Clubs
|
|
||||||
clubs_form = ClubsForm(initial={'clubs': member.clubs.all()})
|
|
||||||
elif not login_clipper:
|
elif not login_clipper:
|
||||||
# new user
|
# new user
|
||||||
user_form = RegistrationPassUserForm()
|
user_form = RegistrationPassUserForm()
|
||||||
|
@ -337,14 +334,12 @@ def registration_form2(request, login_clipper=None, username=None,
|
||||||
profile_form = RegistrationProfileForm()
|
profile_form = RegistrationProfileForm()
|
||||||
cofprofile_form = RegistrationCofProfileForm()
|
cofprofile_form = RegistrationCofProfileForm()
|
||||||
event_formset = EventFormset(events=events, prefix='events')
|
event_formset = EventFormset(events=events, prefix='events')
|
||||||
clubs_form = ClubsForm()
|
|
||||||
return render(request, "cof/registration_form.html",
|
return render(request, "cof/registration_form.html",
|
||||||
{"member": member, "login_clipper": login_clipper,
|
{"member": member, "login_clipper": login_clipper,
|
||||||
"user_form": user_form,
|
"user_form": user_form,
|
||||||
"profile_form": profile_form,
|
"profile_form": profile_form,
|
||||||
"cofprofile_form": cofprofile_form,
|
"cofprofile_form": cofprofile_form,
|
||||||
"event_formset": event_formset,
|
"event_formset": event_formset})
|
||||||
"clubs_form": clubs_form})
|
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
|
@ -368,7 +363,6 @@ def registration(request):
|
||||||
user_form = RegistrationUserForm(request_dict)
|
user_form = RegistrationUserForm(request_dict)
|
||||||
profile_form = RegistrationProfileForm(request_dict)
|
profile_form = RegistrationProfileForm(request_dict)
|
||||||
cofprofile_form = RegistrationCofProfileForm(request_dict)
|
cofprofile_form = RegistrationCofProfileForm(request_dict)
|
||||||
clubs_form = ClubsForm(request_dict)
|
|
||||||
events = Event.objects.filter(old=False).all()
|
events = Event.objects.filter(old=False).all()
|
||||||
event_formset = EventFormset(events=events, data=request_dict,
|
event_formset = EventFormset(events=events, data=request_dict,
|
||||||
prefix='events')
|
prefix='events')
|
||||||
|
@ -409,7 +403,6 @@ def registration(request):
|
||||||
profile_form.is_valid(),
|
profile_form.is_valid(),
|
||||||
cofprofile_form.is_valid(),
|
cofprofile_form.is_valid(),
|
||||||
event_formset.is_valid(),
|
event_formset.is_valid(),
|
||||||
clubs_form.is_valid()
|
|
||||||
))
|
))
|
||||||
if forms_are_valid:
|
if forms_are_valid:
|
||||||
# Enregistrement du profil
|
# Enregistrement du profil
|
||||||
|
@ -455,11 +448,6 @@ def registration(request):
|
||||||
# l'inscription aux événements et/ou donner la
|
# l'inscription aux événements et/ou donner la
|
||||||
# possibilité d'associer un mail aux événements
|
# possibilité d'associer un mail aux événements
|
||||||
# send_custom_mail(...)
|
# send_custom_mail(...)
|
||||||
# Enregistrement des inscriptions aux clubs
|
|
||||||
member.clubs.clear()
|
|
||||||
for club in clubs_form.cleaned_data['clubs']:
|
|
||||||
club.membres.add(member)
|
|
||||||
club.save()
|
|
||||||
success = True
|
success = True
|
||||||
# Messages
|
# Messages
|
||||||
if success:
|
if success:
|
||||||
|
@ -476,56 +464,11 @@ def registration(request):
|
||||||
"cofprofile_form": cofprofile_form,
|
"cofprofile_form": cofprofile_form,
|
||||||
"member": member,
|
"member": member,
|
||||||
"login_clipper": login_clipper,
|
"login_clipper": login_clipper,
|
||||||
"event_formset": event_formset,
|
"event_formset": event_formset})
|
||||||
"clubs_form": clubs_form})
|
|
||||||
else:
|
else:
|
||||||
return render(request, "registration.html")
|
return render(request, "registration.html")
|
||||||
|
|
||||||
|
|
||||||
# -----
|
|
||||||
# Clubs
|
|
||||||
# -----
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def membres_club(request, name):
|
|
||||||
# Vérification des permissions : l'utilisateur doit être membre du burô
|
|
||||||
# ou respo du club.
|
|
||||||
user = request.user
|
|
||||||
club = get_object_or_404(Club, name=name)
|
|
||||||
if not request.user.profile.is_buro \
|
|
||||||
and club not in user.clubs_geres.all():
|
|
||||||
return HttpResponseForbidden('<h1>Permission denied</h1>')
|
|
||||||
members_no_respo = club.membres.exclude(clubs_geres=club).all()
|
|
||||||
return render(request, 'membres_clubs.html',
|
|
||||||
{'club': club,
|
|
||||||
'members_no_respo': members_no_respo})
|
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
|
||||||
def change_respo(request, club_name, user_id):
|
|
||||||
club = get_object_or_404(Club, name=club_name)
|
|
||||||
user = get_object_or_404(User, id=user_id)
|
|
||||||
if user in club.respos.all():
|
|
||||||
club.respos.remove(user)
|
|
||||||
elif user in club.membres.all():
|
|
||||||
club.respos.add(user)
|
|
||||||
else:
|
|
||||||
raise Http404
|
|
||||||
return redirect('membres-club', name=club_name)
|
|
||||||
|
|
||||||
|
|
||||||
@cof_required
|
|
||||||
def liste_clubs(request):
|
|
||||||
clubs = Club.objects
|
|
||||||
if request.user.profile.is_buro:
|
|
||||||
data = {'owned_clubs': clubs.all()}
|
|
||||||
else:
|
|
||||||
data = {'owned_clubs': request.user.clubs_geres,
|
|
||||||
'other_clubs': clubs.exclude(respos=request.user)}
|
|
||||||
return render(request, 'liste_clubs.html', data)
|
|
||||||
|
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def export_members(request):
|
def export_members(request):
|
||||||
response = HttpResponse(content_type='text/csv')
|
response = HttpResponse(content_type='text/csv')
|
||||||
|
|
|
@ -42,26 +42,26 @@ INSTALLED_APPS = (
|
||||||
'bootstrapform',
|
'bootstrapform',
|
||||||
'channels',
|
'channels',
|
||||||
'widget_tweaks',
|
'widget_tweaks',
|
||||||
'bda',
|
|
||||||
'bds',
|
|
||||||
'cof',
|
|
||||||
'gestion',
|
|
||||||
'kfet',
|
|
||||||
'custommail',
|
'custommail',
|
||||||
|
'bda.apps.BdAConfig',
|
||||||
|
'bds.apps.BDSConfig',
|
||||||
|
'cof.apps.COFConfig',
|
||||||
|
'gestion.apps.GestionConfig',
|
||||||
|
'kfet.apps.KFetConfig',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE = [
|
||||||
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
'debug_toolbar.middleware.DebugToolbarMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||||
'kfet.middleware.KFetAuthenticationMiddleware',
|
'kfet.middleware.kfet_auth_middleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
)
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'gestioCOF.urls'
|
ROOT_URLCONF = 'gestioCOF.urls'
|
||||||
|
|
||||||
|
@ -76,9 +76,6 @@ TEMPLATES = [
|
||||||
'django.template.context_processors.request',
|
'django.template.context_processors.request',
|
||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
'django.core.context_processors.i18n',
|
|
||||||
'django.core.context_processors.media',
|
|
||||||
'django.core.context_processors.static',
|
|
||||||
'gestion.context_processors.context_processor',
|
'gestion.context_processors.context_processor',
|
||||||
'kfet.context_processors.auth',
|
'kfet.context_processors.auth',
|
||||||
],
|
],
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
Fichier principal de configuration des urls du projet GestioCOF
|
Fichier principal de configuration des urls du projet GestioCOF
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import autocomplete_light
|
|
||||||
import gestion.urls
|
import gestion.urls
|
||||||
import kfet.urls
|
import kfet.urls
|
||||||
import bda.urls
|
import bda.urls
|
||||||
|
@ -17,14 +16,11 @@ from django.contrib.auth import views as django_views
|
||||||
|
|
||||||
from cof import views as cof_views
|
from cof import views as cof_views
|
||||||
from cof.urls import export_patterns, petitcours_patterns, \
|
from cof.urls import export_patterns, petitcours_patterns, \
|
||||||
surveys_patterns, events_patterns, calendar_patterns, \
|
surveys_patterns, events_patterns, calendar_patterns
|
||||||
clubs_patterns
|
|
||||||
from cof.autocomplete import autocomplete
|
from cof.autocomplete import autocomplete
|
||||||
|
|
||||||
from gestion import views as gestion_views
|
from gestion import views as gestion_views
|
||||||
|
|
||||||
autocomplete_light.autodiscover()
|
|
||||||
|
|
||||||
admin.autodiscover()
|
admin.autodiscover()
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
@ -48,8 +44,6 @@ urlpatterns = [
|
||||||
url(r'^event/', include(events_patterns)),
|
url(r'^event/', include(events_patterns)),
|
||||||
# Calendrier
|
# Calendrier
|
||||||
url(r'^calendar/', include(calendar_patterns)),
|
url(r'^calendar/', include(calendar_patterns)),
|
||||||
# Clubs
|
|
||||||
url(r'^clubs/', include(clubs_patterns)),
|
|
||||||
# Infos persos
|
# Infos persos
|
||||||
url(r'^outsider/password-change$',
|
url(r'^outsider/password-change$',
|
||||||
django_views.password_change,
|
django_views.password_change,
|
||||||
|
|
6
gestion/apps.py
Normal file
6
gestion/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class GestionConfig(AppConfig):
|
||||||
|
name = "gestion"
|
||||||
|
verbose_name = "Gestion des outils communs COF/BDS"
|
|
@ -1,11 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division,
|
|
||||||
print_function, unicode_literals)
|
|
||||||
from builtins import *
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class KFetConfig(AppConfig):
|
class KFetConfig(AppConfig):
|
||||||
name = 'kfet'
|
name = 'kfet'
|
||||||
verbose_name = "Application K-Fêt"
|
verbose_name = "Application K-Fêt"
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import (absolute_import, division,
|
|
||||||
print_function, unicode_literals)
|
|
||||||
from builtins import *
|
|
||||||
|
|
||||||
from django.http import HttpResponseForbidden
|
|
||||||
from kfet.backends import KFetBackend
|
from kfet.backends import KFetBackend
|
||||||
from kfet.models import Account
|
|
||||||
|
|
||||||
class KFetAuthenticationMiddleware(object):
|
|
||||||
def process_request(self, request):
|
def kfet_auth_middleware(get_response):
|
||||||
kfet_backend = KFetBackend()
|
kfet_backend = KFetBackend()
|
||||||
|
|
||||||
|
def middleware(request):
|
||||||
temp_request_user = kfet_backend.authenticate(request)
|
temp_request_user = kfet_backend.authenticate(request)
|
||||||
if temp_request_user:
|
if temp_request_user:
|
||||||
request.real_user = request.user
|
request.real_user = request.user
|
||||||
request.user = temp_request_user
|
request.user = temp_request_user
|
||||||
|
return get_response(request)
|
||||||
|
|
||||||
|
return middleware
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
configparser==3.5.0
|
configparser==3.5.0
|
||||||
Django==1.8.*
|
Django==1.11b1
|
||||||
django-autocomplete-light==2.3.3
|
django-autocomplete-light==2.3.3
|
||||||
django-autoslug==1.9.3
|
django-autoslug==1.9.3
|
||||||
django-cas-ng==3.5.5
|
django-cas-ng==3.5.6
|
||||||
django-grappelli==2.8.1
|
django-recaptcha==1.2.1
|
||||||
django-recaptcha==1.0.5
|
mysqlclient==1.3.10
|
||||||
mysqlclient==1.3.7
|
Pillow
|
||||||
Pillow==3.3.0
|
six
|
||||||
six==1.10.0
|
unicodecsv
|
||||||
unicodecsv==0.14.1
|
icalendar
|
||||||
icalendar==3.10
|
|
||||||
django-bootstrap-form==3.2.1
|
django-bootstrap-form==3.2.1
|
||||||
asgiref==0.14.0
|
asgiref==1.0.0
|
||||||
daphne==0.14.3
|
daphne==1.0.3
|
||||||
asgi-redis==0.14.0
|
asgi-redis==1.0.0
|
||||||
statistics==1.0.3.5
|
statistics==1.0.3.5
|
||||||
future==0.15.2
|
future==0.15.2
|
||||||
django-widget-tweaks==1.4.1
|
django-widget-tweaks==1.4.1
|
||||||
|
|
Loading…
Reference in a new issue