diff --git a/preferences/forms.py b/preferences/forms.py index 03fa6360..fc214f52 100644 --- a/preferences/forms.py +++ b/preferences/forms.py @@ -117,6 +117,7 @@ class EditGeneralOptionForm(ModelForm): self.fields['site_name'].label = 'Nom du site web' self.fields['email_from'].label = "Adresse mail d\ 'expedition automatique" + self.fields['GTU_sum_up'].label = "Résumé des CGU" class EditAssoOptionForm(ModelForm): diff --git a/preferences/models.py b/preferences/models.py index d4c25c24..133d6f82 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -302,6 +302,16 @@ class GeneralOption(models.Model): req_expire_hrs = models.IntegerField(default=48) site_name = models.CharField(max_length=32, default="Re2o") email_from = models.EmailField(default="www-data@serveur.net") + GTU_sum_up = models.TextField( + default="", + blank=True, + ) + GTU = models.FileField( + upload_to = '', + default="", + null=True, + blank=True, + ) class Meta: permissions = ( diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html index 45a4fd11..e46564a3 100644 --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -137,7 +137,13 @@ with this program; if not, write to the Free Software Foundation, Inc., Message global affiché sur le site {{ generaloptions.general_message }} + Résumé des CGU + {{ generaloptions.GTU_sum_up }} + + CGU + {{generaloptions.GTU}} +

Données de l'association

diff --git a/preferences/templates/preferences/edit_preferences.html b/preferences/templates/preferences/edit_preferences.html index 02f006c1..8d75f289 100644 --- a/preferences/templates/preferences/edit_preferences.html +++ b/preferences/templates/preferences/edit_preferences.html @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,

Edition des préférences

-
+ {% csrf_token %} {% massive_bootstrap_form options 'utilisateur_asso' %} {% bootstrap_button "Créer ou modifier" button_type="submit" icon="star" %} diff --git a/preferences/views.py b/preferences/views.py index c7ee5202..7a609a76 100644 --- a/preferences/views.py +++ b/preferences/views.py @@ -95,6 +95,7 @@ def edit_options(request, section): return redirect(reverse('index')) options = form_instance( request.POST or None, + request.FILES or None, instance=options_instance ) if options.is_valid(): diff --git a/re2o/acl.py b/re2o/acl.py index ffbbea42..23636ee4 100644 --- a/re2o/acl.py +++ b/re2o/acl.py @@ -45,11 +45,10 @@ def can_create(model): def decorator(view): def wrapper(request, *args, **kwargs): can, msg = model.can_create(request.user, *args, **kwargs) + #options, _created = OptionalUser.objects.get_or_create() if not can: messages.error(request, msg or "Vous ne pouvez pas accéder à ce menu") - return redirect(reverse('users:profil', - kwargs={'userid':str(request.user.id)} - )) + return redirect(reverse('index')) return view(request, *args, **kwargs) return wrapper return decorator diff --git a/re2o/settings.py b/re2o/settings.py index c342ef93..f88bd266 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -150,7 +150,7 @@ STATICFILES_DIRS = ( ), ) -MEDIA_ROOT = '/var/www/re2o/static' +MEDIA_ROOT = '/var/www/re2o/media' STATIC_URL = '/static/' diff --git a/templates/base.html b/templates/base.html index b3a9bb5d..0a0c3db0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -26,6 +26,8 @@ with this program; if not, write to the Free Software Foundation, Inc., {# Load the tag library #} {% load bootstrap3 %} {% load acl %} +{% load self_adhesion %} +{% self_adhesion as var_sa %} @@ -102,17 +104,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_view_app preferences %}