mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-09-12 01:03:09 +00:00
Premiere vue d'affichage des tickets
This commit is contained in:
parent
fb437dd096
commit
f054c0a2af
7 changed files with 155 additions and 2 deletions
|
@ -77,6 +77,7 @@ LOCAL_APPS = (
|
||||||
're2o',
|
're2o',
|
||||||
'preferences',
|
'preferences',
|
||||||
'logs',
|
'logs',
|
||||||
|
'tickets',
|
||||||
)
|
)
|
||||||
INSTALLED_APPS = (
|
INSTALLED_APPS = (
|
||||||
DJANGO_CONTRIB_APPS +
|
DJANGO_CONTRIB_APPS +
|
||||||
|
|
|
@ -70,6 +70,7 @@ urlpatterns = [
|
||||||
include('cotisations.urls', namespace='cotisations')
|
include('cotisations.urls', namespace='cotisations')
|
||||||
),
|
),
|
||||||
url(r'^machines/', include('machines.urls', namespace='machines')),
|
url(r'^machines/', include('machines.urls', namespace='machines')),
|
||||||
|
url(r'^tickets/', include('tickets.urls', namespace='tickets')),
|
||||||
url(r'^topologie/', include('topologie.urls', namespace='topologie')),
|
url(r'^topologie/', include('topologie.urls', namespace='topologie')),
|
||||||
url(r'^logs/', include('logs.urls', namespace='logs')),
|
url(r'^logs/', include('logs.urls', namespace='logs')),
|
||||||
url(
|
url(
|
||||||
|
|
27
tickets/forms.py
Normal file
27
tickets/forms.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
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__'
|
|
@ -1,3 +1,35 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
# Create your models here.
|
import users.models
|
||||||
|
|
||||||
|
class Ticket(models.Model):
|
||||||
|
"""Class définissant un ticket"""
|
||||||
|
|
||||||
|
user = models.ForeignKey(
|
||||||
|
'users.User',
|
||||||
|
on_delete=models.CASCADE,
|
||||||
|
related_name="tickets")
|
||||||
|
title = models.CharField(
|
||||||
|
max_length=255,
|
||||||
|
help_text=_("Nom du ticket"),
|
||||||
|
blank=False,
|
||||||
|
null=False,)
|
||||||
|
description = models.CharField(
|
||||||
|
max_length=3000,
|
||||||
|
help_text=_("Description du ticket"),
|
||||||
|
blank=False,
|
||||||
|
null=False)
|
||||||
|
date = models.DateTimeField(auto_now_add=True)
|
||||||
|
assigned_staff = models.ForeignKey(
|
||||||
|
'users.User',
|
||||||
|
on_delete=models.PROTECT,
|
||||||
|
related_name="tickets_assigned",
|
||||||
|
blank=False,
|
||||||
|
null=True)
|
||||||
|
#categories = models.OneToManyFiled('Category')
|
||||||
|
solved = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = _("Ticket")
|
||||||
|
verbose_name_plural = _("Tickets")
|
||||||
|
|
59
tickets/templates/tickets/aff_tickets.html
Normal file
59
tickets/templates/tickets/aff_tickets.html
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{% extends 'users/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
|
||||||
|
|
||||||
|
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 i18n %}
|
||||||
|
|
||||||
|
{% block title %}{% trans "Tickets" %}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="table-responsiv">
|
||||||
|
<table class="table" id="machines_table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col"></th>
|
||||||
|
<th scope="col">User</th>
|
||||||
|
<th scope="col">Titre</th>
|
||||||
|
<th scope="col">Date</th>
|
||||||
|
<th scope="col">Résolu</th>
|
||||||
|
</tr>
|
||||||
|
{% for ticket in tickets_list %}
|
||||||
|
<tr>
|
||||||
|
<td> Lien </td>
|
||||||
|
<td>{{ ticket.user }}</td>
|
||||||
|
<td>{{ ticket.title }}</td>
|
||||||
|
<td>{{ ticket.date }}</td>
|
||||||
|
{% if ticket.solved %}
|
||||||
|
<td><i class="fa fa-check" style="color:green"></i></td>
|
||||||
|
{% else %}
|
||||||
|
<td><i class="fa fa-times" style="color:red"></i></td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
10
tickets/urls.py
Normal file
10
tickets/urls.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from django.conf.urls import url
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
url(r'^$', views.aff_tickets, name='index des tickets'),
|
||||||
|
url(r'^new_ticket/(?P<userid>[0-9]+)$',
|
||||||
|
views.new_ticket,
|
||||||
|
name='new-ticket'),
|
||||||
|
]
|
|
@ -1,3 +1,26 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
# Create your views here.
|
from .models import(
|
||||||
|
Ticket
|
||||||
|
)
|
||||||
|
|
||||||
|
def new_ticket(request,user):
|
||||||
|
""" Vue de création d'un ticket """
|
||||||
|
ticket = NewTicketForm(request.POST or None, user=request.user)
|
||||||
|
if ticket.is_valid():
|
||||||
|
new_ticket_obj = machine.save(commit=False)
|
||||||
|
nex_ticket_obj.user = user
|
||||||
|
new_machine_obj.save()
|
||||||
|
|
||||||
|
return form(
|
||||||
|
{
|
||||||
|
'ticketform':ticket,
|
||||||
|
},
|
||||||
|
'ticket/ticket.html',
|
||||||
|
request
|
||||||
|
)
|
||||||
|
def aff_tickets(request):
|
||||||
|
""" Vue d'affichage de tout les tickets """
|
||||||
|
tickets = Ticket.objects.all()
|
||||||
|
return render(request,'tickets/aff_tickets.html',
|
||||||
|
{'tickets_list':tickets})
|
||||||
|
|
Loading…
Reference in a new issue