mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 07:23:46 +00:00
WIP aurore
This commit is contained in:
parent
d5cfe2edd2
commit
2219582163
5 changed files with 13 additions and 4 deletions
|
@ -30,12 +30,12 @@ from django import forms
|
|||
from django.forms import ModelForm, Form
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .models import Preferences
|
||||
from .models import MultiopOption
|
||||
|
||||
|
||||
class EditPreferencesForm(ModelForm):
|
||||
"""Form used to edit the settings of multi_op."""
|
||||
|
||||
class Meta:
|
||||
model = Preferences
|
||||
model = MultiopOption
|
||||
fields = "__all__"
|
||||
|
|
|
@ -28,7 +28,7 @@ from django.db import models
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class Preferences(models.Model):
|
||||
class MultiopOption(models.Model):
|
||||
"""Definition of the settings of multi_op."""
|
||||
|
||||
enabled_dorm = models.ManyToManyField(
|
||||
|
|
|
@ -28,6 +28,7 @@ each.
|
|||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
from .preferences.views import edit_options
|
||||
|
||||
urlpatterns = [
|
||||
url(r"^$", views.aff_state_global, name="aff-state-global"),
|
||||
|
@ -36,6 +37,11 @@ urlpatterns = [
|
|||
views.aff_state_dormitory,
|
||||
name="aff-state-dormitory",
|
||||
),
|
||||
url(
|
||||
r"^edit_options/(?P<section>MultiopOption)$",
|
||||
edit_options,
|
||||
name="edit-options",
|
||||
),
|
||||
url(
|
||||
r"^pending-connection$",
|
||||
views.aff_pending_connection,
|
||||
|
|
|
@ -45,7 +45,7 @@ from preferences.models import GeneralOption, AssoOption
|
|||
|
||||
from .forms import DormitoryForm
|
||||
|
||||
from .preferences.models import Preferences
|
||||
from .preferences.models import MultiopOption
|
||||
|
||||
from topologie.models import Room, Dormitory
|
||||
|
||||
|
|
|
@ -128,6 +128,8 @@ def edit_options_template_function(request, section, forms, models):
|
|||
)
|
||||
def display_options(request):
|
||||
"""View used to display preferences sorted by model."""
|
||||
|
||||
# The mandatory options are loaded manually
|
||||
useroptions, _created = OptionalUser.objects.get_or_create()
|
||||
machineoptions, _created = OptionalMachine.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()
|
||||
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_templates_list = [
|
||||
app.preferences.views.aff_preferences(request)
|
||||
|
|
Loading…
Reference in a new issue