mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-24 20:33:11 +00:00
Nouveau réglage code_duration + context processor mise en cache settings
This commit is contained in:
parent
2c849c7064
commit
1d6b5952f6
4 changed files with 30 additions and 3 deletions
21
preferences/migrations/0056_optionalprinter_code_duration.py
Normal file
21
preferences/migrations/0056_optionalprinter_code_duration.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2018-11-29 21:50
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('preferences', '0055_generaloption_main_site_url'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='optionalprinter',
|
||||||
|
name='code_duration',
|
||||||
|
field=models.DurationField(default=datetime.timedelta(1), help_text='Digicode max duration for printer'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -589,7 +589,7 @@ class MailMessageOption(AclMixin, models.Model):
|
||||||
verbose_name = _("email message options")
|
verbose_name = _("email message options")
|
||||||
|
|
||||||
|
|
||||||
class OptionalPrinter(AclMixin, models.Model):
|
class OptionalPrinter(AclMixin, PreferencesModel):
|
||||||
"""Preference for Printer app"""
|
"""Preference for Printer app"""
|
||||||
|
|
||||||
Printer_enabled = models.BooleanField(
|
Printer_enabled = models.BooleanField(
|
||||||
|
@ -669,6 +669,11 @@ class OptionalPrinter(AclMixin, models.Model):
|
||||||
default=0.0,
|
default=0.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
code_duration = models.DurationField(
|
||||||
|
default=timedelta(days=1),
|
||||||
|
help_text=_("Digicode max duration for printer")
|
||||||
|
)
|
||||||
|
|
||||||
permissions = (
|
permissions = (
|
||||||
("view_optionalprinter", _("Can view the printer options")),
|
("view_optionalprinter", _("Can view the printer options")),
|
||||||
)
|
)
|
||||||
|
|
|
@ -382,6 +382,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Staples price" %}</th>
|
<th>{% trans "Staples price" %}</th>
|
||||||
<td>{{ printeroptions.Staples_price }}</td>
|
<td>{{ printeroptions.Staples_price }}</td>
|
||||||
|
<th>{% trans "Digicode duration" %}</th>
|
||||||
|
<td>{{ printeroptions.code_duration }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,7 @@ def context_printer(request):
|
||||||
"""
|
"""
|
||||||
Useful to know whether the printer app is activated or not
|
Useful to know whether the printer app is activated or not
|
||||||
"""
|
"""
|
||||||
printerSettings = OptionalPrinter.objects.get()
|
printer = ('printer' in INSTALLED_APPS) and OptionalPrinter.get_cached_value('Printer_enabled')
|
||||||
printer = ('printer' in INSTALLED_APPS) and printerSettings.Printer_enabled
|
|
||||||
return {
|
return {
|
||||||
'printer': printer,
|
'printer': printer,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue