8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-04 17:06:27 +00:00
re2o/tickets/forms.py

28 lines
822 B
Python
Raw Normal View History

2019-07-07 17:09:56 +00:00
from django import forms
from django.forms import ModelForm, Form
from .models import(
Ticket
)
class EditTicketForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
"""Formulaire d'edition d'un Ticket"""
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):
""" Creation d'une machine"""
class Meta(EditeTicketForm):
fields = '__all__'