diff --git a/tickets/migrations/0001_squashed_0007_preferences_publish_tickets.py b/tickets/migrations/0001_initial.py similarity index 56% rename from tickets/migrations/0001_squashed_0007_preferences_publish_tickets.py rename to tickets/migrations/0001_initial.py index b2293a4a..a2d1a5d8 100644 --- a/tickets/migrations/0001_squashed_0007_preferences_publish_tickets.py +++ b/tickets/migrations/0001_initial.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.10.7 on 2019-08-16 13:41 +# Generated by Django 1.10.7 on 2019-08-19 08:19 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion +import re2o.mixins class Migration(migrations.Migration): - replaces = [('tickets', '0001_initial'), ('tickets', '0002_auto_20190710_0952'), ('tickets', '0003_ticket_email'), ('tickets', '0004_auto_20190712_1205'), ('tickets', '0005_auto_20190712_1209'), ('tickets', '0006_preferences'), ('tickets', '0007_preferences_publish_tickets')] - initial = True dependencies = [ @@ -18,32 +17,32 @@ class Migration(migrations.Migration): ] operations = [ + migrations.CreateModel( + name='Preferences', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('publish_address', models.EmailField(help_text='Email address to publish the new tickets (leave empty for no publications)', max_length=1000, null=True)), + ('mail_language', models.IntegerField(choices=[(0, 'Français'), (1, 'English')], default=0)), + ], + options={ + 'verbose_name': "Ticket's settings", + }, + ), migrations.CreateModel( name='Ticket', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(help_text='Nom du ticket', max_length=255)), - ('description', models.TextField(help_text='Description du ticket', max_length=3000)), + ('title', models.CharField(help_text='Title of the ticket', max_length=255)), + ('description', models.TextField(help_text='Description of the ticket', max_length=3000)), ('date', models.DateTimeField(auto_now_add=True)), + ('email', models.EmailField(help_text='An email address to get back to you', max_length=100, null=True)), ('solved', models.BooleanField(default=False)), - ('assigned_staff', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='tickets_assigned', to=settings.AUTH_USER_MODEL)), ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tickets', to=settings.AUTH_USER_MODEL)), - ('email', models.EmailField(help_text='Une adresse mail pour vous recontacter', max_length=100, null=True)), ], options={ 'verbose_name': 'Ticket', 'verbose_name_plural': 'Tickets', }, - ), - migrations.CreateModel( - name='Preferences', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('publish_address', models.EmailField(help_text='Adresse mail pour annoncer les nouveau tickets (laisser vide pour ne rien annoncer)', max_length=1000, null=True)), - ('publish_tickets', models.BooleanField(default=True, help_text='Publier ou pas les tickets')), - ], - options={ - 'verbose_name': 'Préférences des tickets', - }, + bases=(re2o.mixins.AclMixin, models.Model), ), ] diff --git a/tickets/preferences/models.py b/tickets/preferences/models.py index 684c192e..da77fdff 100644 --- a/tickets/preferences/models.py +++ b/tickets/preferences/models.py @@ -8,5 +8,12 @@ class Preferences(models.Model): help_text = _("Email address to publish the new tickets (leave empty for no publications)"), max_length = 1000, null = True) + LANG_FR = 0 + LANG_EN = 1 + LANGUES = ( + (0,_("Français")), + (1,_("English")), + ) + mail_language = models.IntegerField(choices=LANGUES,default = LANG_FR) class Meta: verbose_name = _("Ticket's settings") diff --git a/tickets/templates/tickets/form_preferences.html b/tickets/templates/tickets/form_preferences.html index 03a6a333..5c7e5d5e 100644 --- a/tickets/templates/tickets/form_preferences.html +++ b/tickets/templates/tickets/form_preferences.html @@ -42,6 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% endblock %} diff --git a/tickets/templates/tickets/preferences.html b/tickets/templates/tickets/preferences.html index 8f9fe490..60cbfac6 100644 --- a/tickets/templates/tickets/preferences.html +++ b/tickets/templates/tickets/preferences.html @@ -18,14 +18,17 @@Email de publication |
-
+ {% trans "Publication email address"%} |
{% if preferences.publish_address %}
{{ preferences.publish_address }} |
{% else %}
{% trans "Pas d'adresse, les tickets ne sont pas annoncés" %} |
{% endif %}
---|---|---|---|
{% trans "Email language" %} |
+ {{ language }} + |