mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 20:03:11 +00:00
Ajout d'un lien vers le profil dans le mail
This commit is contained in:
parent
cb3fdff202
commit
19f4fdbf97
2 changed files with 10 additions and 4 deletions
|
@ -11,6 +11,8 @@ from preferences.models import GeneralOption
|
||||||
|
|
||||||
import users.models
|
import users.models
|
||||||
|
|
||||||
|
from .preferences.models import Preferences
|
||||||
|
|
||||||
class Ticket(AclMixin, models.Model):
|
class Ticket(AclMixin, models.Model):
|
||||||
"""Class définissant un ticket"""
|
"""Class définissant un ticket"""
|
||||||
|
|
||||||
|
@ -49,12 +51,16 @@ class Ticket(AclMixin, models.Model):
|
||||||
verbose_name_plural = _("Tickets")
|
verbose_name_plural = _("Tickets")
|
||||||
|
|
||||||
def __str__(self):
|
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):
|
def publish_mail(self):
|
||||||
|
site_url = GeneralOption.objects.first().main_site_url
|
||||||
to_addr = Preferences.objects.first().publish_address
|
to_addr = Preferences.objects.first().publish_address
|
||||||
template = loader.get_template('tickets/publication_mail')
|
template = loader.get_template('tickets/publication_mail')
|
||||||
context = Context({'ticket':self})
|
context = Context({'ticket':self,'site_url':site_url})
|
||||||
send_mail(
|
send_mail(
|
||||||
'Nouvelle ouverture de ticket',
|
'Nouvelle ouverture de ticket',
|
||||||
template.render(context),
|
template.render(context),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{% if ticket.user %}
|
{% if ticket.user %} {{ ticket.user.get_full_name }} à ouvert un ticket.
|
||||||
{{ 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}}.
|
Répondre à l'adresse: {{ticket.user.get_mail}}.
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in a new issue