8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-04 17:06:27 +00:00
re2o/tickets/views.py
2019-08-11 19:24:40 +02:00

32 lines
891 B
Python

from django.shortcuts import render
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_ticket(request,ticketid):
"""Vue d'affichage d'un ticket"""
ticket = Ticket.objects.filter(id=ticketid).get()
return render(request,'tickets/aff_ticket.html',{'ticket':ticket})
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})