mirror of https://gitlab.federez.net/re2o/re2o
committed by
Gabriel Detraz
7 changed files with 102 additions and 30 deletions
@ -1,3 +1,4 @@ |
|||
from django.contrib import admin |
|||
|
|||
from .models import Ticket |
|||
admin.site.register(Ticket) |
|||
# Register your models here. |
|||
|
|||
@ -1,27 +1,34 @@ |
|||
from django import forms |
|||
from django.forms import ModelForm, Form |
|||
from re2o.field_permissions import FieldPermissionFormMixin |
|||
from re2o.mixins import FormRevMixin |
|||
from django.utils.translation import ugettext_lazy as _ |
|||
|
|||
from .models import( |
|||
Ticket |
|||
) |
|||
|
|||
class EditTicketForm(FormRevMixin, FieldPermissionFormMixin, ModelForm): |
|||
class EditTicketForm(FormRevMixin, ModelForm): |
|||
"""Formulaire d'edition d'un Ticket""" |
|||
|
|||
#def __init__(self,*args, **kwargs): |
|||
#prefix = kwargs.pop('prefix',self.Meta.model.__name__) |
|||
#super(EditTicketForm, self).__init__(*args, prefix=prefix, **kwargs) |
|||
#self.fields['title'].label = _("Titre du ticket") |
|||
#self.fields['decription'].label = _("Description du ticket") |
|||
#self.fields['solved'].label = _("Problème réglé ?") |
|||
|
|||
class Meta: |
|||
model = Ticket |
|||
exclude = ['user','assigned_staff','date'] |
|||
|
|||
def __init__(self,*args, **kwargs): |
|||
prefix = kwargs.pop('prefix',self.Meta.model.__name__) |
|||
super(EditMachineForm, self).__init__(*args, prefix=prefix, **kwargs) |
|||
self.fields['title'].label = _("Titre du ticket") |
|||
self.fields['decription'].label = _("Description du ticket") |
|||
self.field['solved'].label = _("Problème réglé ?") |
|||
|
|||
|
|||
|
|||
class NewTicketForm(EditTicketForm): |
|||
class NewTicketForm(ModelForm): |
|||
""" Creation d'une machine""" |
|||
class Meta(EditeTicketForm): |
|||
fields = '__all__' |
|||
class Meta: |
|||
model = Ticket |
|||
fields = ['title', 'description'] |
|||
|
|||
#def __init(self,*args, **kwargs): |
|||
#prefix = kwargs.pop('prefix', self.Meta.model.__name__) |
|||
#super(NewTicketForm, self).__init__(*args, prefix=prefix, **kwargs) |
|||
|
|||
@ -0,0 +1,48 @@ |
|||
{% extends 'machines/sidebar.html' %} |
|||
{% comment %} |
|||
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 © 2017 Gabriel Détraz |
|||
Copyright © 2017 Goulven Kermarec |
|||
Copyright © 2017 Augustin Lemesle |
|||
Copyright © 2017 Maël Kervella |
|||
|
|||
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. |
|||
{% endcomment %} |
|||
|
|||
{% load bootstrap3 %} |
|||
{% load massive_bootstrap_form %} |
|||
{% load i18n %} |
|||
|
|||
{% block title %}{% trans "Ticket" %}{% endblock %} |
|||
|
|||
{% block content %} |
|||
<h2> Ouverture d'un Ticket </h2> |
|||
|
|||
{% for message in messages %} |
|||
<div class="{{ message| bootstrap_message_classes }} alert-dismissable"> |
|||
<button type="button" class="close" data_dismiss="alert" aria-hidden="true">}</button> |
|||
{{ message | safe }} |
|||
</div> |
|||
{% endfor %} |
|||
|
|||
<form method="post"> |
|||
{% csrf_token %} |
|||
{% bootstrap_form ticketform %} |
|||
{% bootstrap_button "Ouvrir le Ticket" button_type="submit" icon='ok' button_class='btn-success' %} |
|||
</form> |
|||
{% endblock %} |
|||
Loading…
Reference in new issue