diff --git a/preferences/admin.py b/preferences/admin.py index 96b4d9e1..296dc57c 100644 --- a/preferences/admin.py +++ b/preferences/admin.py @@ -28,8 +28,16 @@ from __future__ import unicode_literals from django.contrib import admin from reversion.admin import VersionAdmin -from .models import OptionalUser, OptionalMachine, OptionalTopologie -from .models import GeneralOption, Service, AssoOption, MailMessageOption +from .models import ( + OptionalUser, + OptionalMachine, + OptionalTopologie, + GeneralOption, + Service, + AssoOption, + MailMessageOption, + HomeOption +) class OptionalUserAdmin(VersionAdmin): @@ -67,10 +75,16 @@ class MailMessageOptionAdmin(VersionAdmin): pass +class HomeOptionAdmin(VersionAdmin): + """Class admin options home""" + pass + + admin.site.register(OptionalUser, OptionalUserAdmin) admin.site.register(OptionalMachine, OptionalMachineAdmin) admin.site.register(OptionalTopologie, OptionalTopologieAdmin) admin.site.register(GeneralOption, GeneralOptionAdmin) +admin.site.register(HomeOption, HomeOptionAdmin) admin.site.register(Service, ServiceAdmin) admin.site.register(AssoOption, AssoOptionAdmin) admin.site.register(MailMessageOption, MailMessageOptionAdmin) diff --git a/preferences/forms.py b/preferences/forms.py index b33e4704..afe111a2 100644 --- a/preferences/forms.py +++ b/preferences/forms.py @@ -34,7 +34,7 @@ from .models import ( GeneralOption, AssoOption, MailMessageOption, - AccueilOption, + HomeOption, Service ) @@ -192,15 +192,15 @@ class EditMailMessageOptionForm(ModelForm): mail de bienvenue en anglais' -class EditAccueilOptionForm(ModelForm): - """Formulaire d'édition des options de la page d'accueil""" +class EditHomeOptionForm(ModelForm): + """Edition forms of Home options""" class Meta: - model = AccueilOption + model = HomeOption fields = '__all__' def __init__(self, *args, **kwargs): prefix = kwargs.pop('prefix', self.Meta.model.__name__) - super(EditAccueilOptionForm, self).__init__( + super(EditHomeOptionForm, self).__init__( *args, prefix=prefix, **kwargs diff --git a/preferences/migrations/0034_auto_20180416_1120.py b/preferences/migrations/0034_auto_20180416_1120.py new file mode 100644 index 00000000..5f27ffe5 --- /dev/null +++ b/preferences/migrations/0034_auto_20180416_1120.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-04-16 16:20 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('preferences', '0033_accueiloption'), + ] + + operations = [ + migrations.RenameModel( + old_name='AccueilOption', + new_name='HomeOption', + ), + migrations.AlterModelOptions( + name='homeoption', + options={'permissions': (('view_homeoption', "Peut voir les options de l'accueil"),)}, + ), + ] diff --git a/preferences/models.py b/preferences/models.py index 85f51c52..560fa30f 100644 --- a/preferences/models.py +++ b/preferences/models.py @@ -331,8 +331,8 @@ def assooption_post_save(**kwargs): asso_pref.set_in_cache() -class AccueilOption(AclMixin, PreferencesModel): - """Reglages de la page d'accueil""" +class HomeOption(AclMixin, PreferencesModel): + """Settings of the home page (facebook/twitter etc)""" PRETTY_NAME = "Options de la page d'accueil" facebook_url = models.URLField( @@ -354,15 +354,15 @@ class AccueilOption(AclMixin, PreferencesModel): class Meta: permissions = ( - ("view_accueiloption", "Peut voir les options de l'accueil"), + ("view_homeoption", "Peut voir les options de l'accueil"), ) -@receiver(post_save, sender=AccueilOption) -def accueiloption_post_save(**kwargs): +@receiver(post_save, sender=HomeOption) +def homeoption_post_save(**kwargs): """Ecriture dans le cache""" - accueil_pref = kwargs['instance'] - accueil_pref.set_in_cache() + home_pref = kwargs['instance'] + home_pref.set_in_cache() class MailMessageOption(AclMixin, models.Model): diff --git a/preferences/templates/preferences/display_preferences.html b/preferences/templates/preferences/display_preferences.html index 575ddcac..f43e9696 100644 --- a/preferences/templates/preferences/display_preferences.html +++ b/preferences/templates/preferences/display_preferences.html @@ -218,7 +218,7 @@ with this program; if not, write to the Free Software Foundation, Inc., Supprimer un ou plusieurs service {% include "preferences/aff_service.html" with service_list=service_list %} - + Editer @@ -227,13 +227,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Url du compte twitter | -{{ accueiloptions.twitter_url }} | +{{ homeoptions.twitter_url }} | Nom utilisé pour afficher le compte | -{{ accueiloptions.twitter_account_name }} | +{{ homeoptions.twitter_account_name }} |
---|---|---|---|---|---|
Url du compte facebook | -{{ accueiloptions.facebook_url }} | +{{ homeoptions.facebook_url }} |