Example #1
0
 def get_context_data(self, **kwargs):
     from tickets.models import Ticket
     from tickets.const import TICKET_DETAIL_URL
     ticket_id = self.request.session.get("auth_ticket_id")
     if not ticket_id:
         ticket = None
     else:
         ticket = Ticket.all().filter(pk=ticket_id).first()
     context = super().get_context_data(**kwargs)
     if ticket:
         timestamp_created = datetime.datetime.timestamp(ticket.date_created)
         ticket_detail_url = TICKET_DETAIL_URL.format(id=ticket_id, type=ticket.type)
         assignees = ticket.current_node.first().ticket_assignees.all()
         assignees_display = ', '.join([str(i.assignee) for i in assignees])
         msg = _("""Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>
               Don't close this page""").format(assignees_display)
     else:
         timestamp_created = 0
         ticket_detail_url = ''
         msg = _("No ticket found")
     context.update({
         "msg": msg,
         "timestamp": timestamp_created,
         "ticket_detail_url": ticket_detail_url
     })
     return context
Example #2
0
 def get_context_data(self, **kwargs):
     from tickets.models import Ticket
     from tickets.const import TICKET_DETAIL_URL
     ticket_id = self.request.session.get("auth_ticket_id")
     if not ticket_id:
         ticket = None
     else:
         ticket = get_object_or_none(Ticket, pk=ticket_id)
     context = super().get_context_data(**kwargs)
     if ticket:
         timestamp_created = datetime.datetime.timestamp(
             ticket.date_created)
         ticket_detail_url = TICKET_DETAIL_URL.format(id=ticket_id)
         msg = _(
             """Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>
               Don't close this page""").format(ticket.assignees_display)
     else:
         timestamp_created = 0
         ticket_detail_url = ''
         msg = _("No ticket found")
     context.update({
         "msg": msg,
         "timestamp": timestamp_created,
         "ticket_detail_url": ticket_detail_url
     })
     return context