emile 4 months ago
parent 49d461d4ac
commit b10f00bf1f

@ -462,6 +462,16 @@ class Status(models.Model):
return None return None
return None return None
@property
def project_name(self):
if self.type == 'Task' and self.type_id:
try:
task = Task.objects.get(id=self.type_id)
return task.project.name
except Task.DoesNotExist:
return None
return None
@receiver(post_save, sender=Status) @receiver(post_save, sender=Status)
def new_ticket_update_handler(sender, instance, created, **kwargs): def new_ticket_update_handler(sender, instance, created, **kwargs):
if created: if created:

@ -172,7 +172,7 @@
<a {% if status.type == 'Task' and status.type_id %} href="{% url 'detailed-project' status.project %}" {% elif status.type == 'Daily Report' %} href="{% url 'dailyreports' %}" {% endif %}> <a {% if status.type == 'Task' and status.type_id %} href="{% url 'detailed-project' status.project %}" {% elif status.type == 'Daily Report' %} href="{% url 'dailyreports' %}" {% endif %}>
<div class="w-full flex justify-end items-center mt-1 text-gray-400 hover:text-secondosiblue duration-300 cursor-pointer"> <div class="w-full flex justify-end items-center mt-1 text-gray-400 hover:text-secondosiblue duration-300 cursor-pointer">
{% if status.type == 'Task' %} {% if status.type == 'Task' %}
<p class="text-xs font-light">{{status.task.project}}</p> <p class="text-xs font-light">{{status.project_name}}</p>
{% elif status.type == 'Daily Report' %} {% elif status.type == 'Daily Report' %}
<p class="text-xs font-light">View Daily Report</p> <p class="text-xs font-light">View Daily Report</p>
{% endif %} {% endif %}

Loading…
Cancel
Save