8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

WIP aurore

This commit is contained in:
histausse 2020-09-01 11:10:11 +02:00 committed by histausse
parent d5cfe2edd2
commit 2219582163
5 changed files with 13 additions and 4 deletions

View file

@ -30,12 +30,12 @@ from django import forms
from django.forms import ModelForm, Form from django.forms import ModelForm, Form
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from .models import Preferences from .models import MultiopOption
class EditPreferencesForm(ModelForm): class EditPreferencesForm(ModelForm):
"""Form used to edit the settings of multi_op.""" """Form used to edit the settings of multi_op."""
class Meta: class Meta:
model = Preferences model = MultiopOption
fields = "__all__" fields = "__all__"

View file

@ -28,7 +28,7 @@ from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
class Preferences(models.Model): class MultiopOption(models.Model):
"""Definition of the settings of multi_op.""" """Definition of the settings of multi_op."""
enabled_dorm = models.ManyToManyField( enabled_dorm = models.ManyToManyField(

View file

@ -28,6 +28,7 @@ each.
from django.conf.urls import url from django.conf.urls import url
from . import views from . import views
from .preferences.views import edit_options
urlpatterns = [ urlpatterns = [
url(r"^$", views.aff_state_global, name="aff-state-global"), url(r"^$", views.aff_state_global, name="aff-state-global"),
@ -36,6 +37,11 @@ urlpatterns = [
views.aff_state_dormitory, views.aff_state_dormitory,
name="aff-state-dormitory", name="aff-state-dormitory",
), ),
url(
r"^edit_options/(?P<section>MultiopOption)$",
edit_options,
name="edit-options",
),
url( url(
r"^pending-connection$", r"^pending-connection$",
views.aff_pending_connection, views.aff_pending_connection,

View file

@ -45,7 +45,7 @@ from preferences.models import GeneralOption, AssoOption
from .forms import DormitoryForm from .forms import DormitoryForm
from .preferences.models import Preferences from .preferences.models import MultiopOption
from topologie.models import Room, Dormitory from topologie.models import Room, Dormitory

View file

@ -128,6 +128,8 @@ def edit_options_template_function(request, section, forms, models):
) )
def display_options(request): def display_options(request):
"""View used to display preferences sorted by model.""" """View used to display preferences sorted by model."""
# The mandatory options are loaded manually
useroptions, _created = OptionalUser.objects.get_or_create() useroptions, _created = OptionalUser.objects.get_or_create()
machineoptions, _created = OptionalMachine.objects.get_or_create() machineoptions, _created = OptionalMachine.objects.get_or_create()
topologieoptions, _created = OptionalTopologie.objects.get_or_create() topologieoptions, _created = OptionalTopologie.objects.get_or_create()
@ -146,6 +148,7 @@ def display_options(request):
cotisationsoptions, _created = CotisationsOption.objects.get_or_create() cotisationsoptions, _created = CotisationsOption.objects.get_or_create()
document_template_list = DocumentTemplate.objects.order_by("name") document_template_list = DocumentTemplate.objects.order_by("name")
# Then all the optionnal options (from optionnal apps) are loaded if they exists
optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS_RE2O] optionnal_apps = [import_module(app) for app in OPTIONNAL_APPS_RE2O]
optionnal_templates_list = [ optionnal_templates_list = [
app.preferences.views.aff_preferences(request) app.preferences.views.aff_preferences(request)