mirror of https://gitlab.federez.net/re2o/re2o
11 changed files with 311 additions and 86 deletions
@ -1,5 +1,37 @@ |
|||
# -*- mode: python; coding: utf-8 -*- |
|||
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
# se veut agnostique au réseau considéré, de manière à être installable en |
|||
# quelques clics. |
|||
# |
|||
# Copyright © 2019 Arthur Grisel-Davy |
|||
# Copyright © 2020 Gabriel Détraz |
|||
# |
|||
# This program is free software; you can redistribute it and/or modify |
|||
# it under the terms of the GNU General Public License as published by |
|||
# the Free Software Foundation; either version 2 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU General Public License along |
|||
# with this program; if not, write to the Free Software Foundation, Inc., |
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
""" |
|||
Ticket preferences model |
|||
""" |
|||
|
|||
|
|||
from django.contrib import admin |
|||
from .models import Ticket |
|||
|
|||
admin.site.register(Ticket) |
|||
# Register your models here. |
|||
from reversion.admin import VersionAdmin |
|||
|
|||
class TicketAdmin(VersionAdmin): |
|||
"""Gestion des ticket""" |
|||
|
|||
pass |
|||
|
|||
admin.site.register(Ticket, TicketAdmin) |
|||
|
|||
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.11.28 on 2020-04-22 16:39 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('tickets', '0002_auto_20191120_0159'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RenameModel( |
|||
old_name='Preferences', |
|||
new_name='TicketOption', |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='ticketoption', |
|||
options={'permissions': (('view_ticketoption', 'Can view tickets options'),), 'verbose_name': 'tickets options'}, |
|||
), |
|||
] |
|||
@ -1,13 +1,45 @@ |
|||
# -*- mode: python; coding: utf-8 -*- |
|||
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
# se veut agnostique au réseau considéré, de manière à être installable en |
|||
# quelques clics. |
|||
# |
|||
# Copyright © 2019 Arthur Grisel-Davy |
|||
# Copyright © 2020 Gabriel Détraz |
|||
# |
|||
# This program is free software; you can redistribute it and/or modify |
|||
# it under the terms of the GNU General Public License as published by |
|||
# the Free Software Foundation; either version 2 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU General Public License along |
|||
# with this program; if not, write to the Free Software Foundation, Inc., |
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
""" |
|||
Ticket preferences form |
|||
""" |
|||
|
|||
from django import forms |
|||
from django.forms import ModelForm, Form |
|||
from django.utils.translation import ugettext_lazy as _ |
|||
|
|||
from .models import Preferences |
|||
from re2o.mixins import FormRevMixin |
|||
from .models import TicketOption |
|||
|
|||
|
|||
class EditPreferencesForm(ModelForm): |
|||
class EditTicketOptionForm(FormRevMixin, ModelForm): |
|||
""" Edit the ticket's settings""" |
|||
|
|||
class Meta: |
|||
model = Preferences |
|||
model = TicketOption |
|||
fields = "__all__" |
|||
|
|||
def __init__(self, *args, **kwargs): |
|||
prefix = kwargs.pop("prefix", self.Meta.model.__name__) |
|||
super(EditTicketOptionForm, self).__init__(*args, prefix=prefix, **kwargs) |
|||
self.fields["publish_address"].label = _("Publish address") |
|||
self.fields["mail_language"].label = _("Mail language") |
|||
|
|||
@ -0,0 +1,60 @@ |
|||
# -*- mode: python; coding: utf-8 -*- |
|||
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
# se veut agnostique au réseau considéré, de manière à être installable en |
|||
# quelques clics. |
|||
# |
|||
# Copyright © 2020 Gabriel Détraz |
|||
# Copyright © 2019 Arthur Grisel-Davy |
|||
# |
|||
# This program is free software; you can redistribute it and/or modify |
|||
# it under the terms of the GNU General Public License as published by |
|||
# the Free Software Foundation; either version 2 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU General Public License along |
|||
# with this program; if not, write to the Free Software Foundation, Inc., |
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
|
|||
# App de gestion des users pour re2o |
|||
# Lara Kermarec, Gabriel Détraz, Lemesle Augustin |
|||
# Gplv2 |
|||
|
|||
from django.contrib import messages |
|||
from django.contrib.auth.decorators import login_required |
|||
from django.shortcuts import render, redirect |
|||
from django.template.loader import render_to_string |
|||
from django.views.decorators.cache import cache_page |
|||
from django.utils.translation import ugettext as _ |
|||
from django.urls import reverse |
|||
from django.forms import modelformset_factory |
|||
from re2o.views import form |
|||
|
|||
from re2o.base import re2o_paginator |
|||
|
|||
from re2o.acl import can_view, can_view_all, can_edit, can_create |
|||
|
|||
from preferences.utils.views import edit_options_template_function |
|||
|
|||
from . import forms |
|||
from . import models |
|||
|
|||
def aff_preferences(request): |
|||
""" View to display the settings of the tickets in the preferences page""" |
|||
pref, created = models.TicketOption.objects.get_or_create() |
|||
context = { |
|||
"preferences": pref, |
|||
"language": str(pref.LANGUES[pref.mail_language][1]), |
|||
} |
|||
return render_to_string( |
|||
"tickets/preferences.html", context=context, request=request, using=None |
|||
) |
|||
|
|||
@login_required |
|||
def edit_options(request, section): |
|||
return edit_options_template_function(request, section, forms, models) |
|||
|
|||
@ -1,14 +1,40 @@ |
|||
# -*- mode: python; coding: utf-8 -*- |
|||
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
# se veut agnostique au réseau considéré, de manière à être installable en |
|||
# quelques clics. |
|||
# |
|||
# Copyright © 2019 Arthur Grisel-Davy |
|||
# Copyright © 2020 Gabriel Détraz |
|||
# |
|||
# This program is free software; you can redistribute it and/or modify |
|||
# it under the terms of the GNU General Public License as published by |
|||
# the Free Software Foundation; either version 2 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU General Public License along |
|||
# with this program; if not, write to the Free Software Foundation, Inc., |
|||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
""" |
|||
Tickets url |
|||
""" |
|||
|
|||
from django.conf.urls import url |
|||
|
|||
from . import views |
|||
from .preferences.views import edit_options |
|||
|
|||
urlpatterns = [ |
|||
url(r"^$", views.aff_tickets, name="aff-tickets"), |
|||
url(r"^ticket/(?P<ticketid>[0-9]+)$", views.aff_ticket, name="aff-ticket"), |
|||
url(r"^(?P<ticketid>[0-9]+)$", views.aff_ticket, name="aff-ticket"), |
|||
url( |
|||
r"^ticket/edit-preferences-tickets$", |
|||
views.edit_preferences, |
|||
name="edit-preferences-tickets", |
|||
r"^edit_options/(?P<section>TicketOption)$", |
|||
edit_options, |
|||
name="edit-options", |
|||
), |
|||
url(r"^new_ticket/$", views.new_ticket, name="new-ticket"), |
|||
] |
|||
|
|||
Loading…
Reference in new issue