8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Ajout d'un lien vers le profil dans le mail

This commit is contained in:
Grizzly 2019-08-14 15:09:46 +00:00
parent cb3fdff202
commit 19f4fdbf97
2 changed files with 10 additions and 4 deletions

View file

@ -11,6 +11,8 @@ from preferences.models import GeneralOption
import users.models
from .preferences.models import Preferences
class Ticket(AclMixin, models.Model):
"""Class définissant un ticket"""
@ -49,12 +51,16 @@ class Ticket(AclMixin, models.Model):
verbose_name_plural = _("Tickets")
def __str__(self):
return "Ticket de {} date: {}".format(self.user.surname,self.date)
if self.user:
return "Ticket de {}. Date: {}".format(self.user.surname,self.date)
else:
return "Ticket anonyme. Date: {}".format(self.date)
def publish_mail(self):
site_url = GeneralOption.objects.first().main_site_url
to_addr = Preferences.objects.first().publish_address
template = loader.get_template('tickets/publication_mail')
context = Context({'ticket':self})
context = Context({'ticket':self,'site_url':site_url})
send_mail(
'Nouvelle ouverture de ticket',
template.render(context),

View file

@ -1,5 +1,5 @@
{% if ticket.user %}
{{ ticket.user.get_full_name }} à ouvert un ticket.
{% if ticket.user %} {{ ticket.user.get_full_name }} à ouvert un ticket.
Profile: {{site_url}}{% url 'users:profil' ticket.user.id%}
Répondre à l'adresse: {{ticket.user.get_mail}}.
{% else %}