Skip to content
Snippets Groups Projects
Verified Commit dd22f634 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Move color detection from models.py to template and use type detection instead

parent 695ccc2d
No related branches found
No related tags found
1 merge request!31Biscuit merge. Closes #53.
......@@ -334,12 +334,12 @@ class LessonSubstitution(models.Model):
raise ValidationError(_("Lessons can only be either substituted or cancelled."))
@property
def color(self):
def type(self):
# TODO: Add cases events and supervisions
if self.cancelled:
return "green"
# Add cases for purple and blue (events and supervisements)
return "cancellation"
else:
return "black"
return "substitution"
class Meta:
unique_together = [["lesson_period", "week"]]
......
......@@ -78,7 +78,7 @@
</td>
{% endif %}
{% for sub in substitutions %}
<tr class="{{ sub.color }}-text">
<tr class="{% if sub.type == "cancellation" %}green-text{% else %}black-text{% endif %}"> {# TODO: Extend support for blue and purple (supervisions and events) #}
<td>
{% include "chronos/partials/groups.html" with groups=sub.lesson_period.lesson.groups.all %}
</td>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment