Fixer Timer.stop method to respect custom end argument.

This commit is contained in:
Christopher Charbonneau Wells 2017-09-09 13:00:13 -04:00
parent c38290838b
commit 99dcb1e7ca
2 changed files with 7 additions and 5 deletions

View File

@ -182,7 +182,7 @@ class Timer(models.Model):
def stop(self, end=None):
"""Stop the timer."""
if not self.end:
self.end = timezone.now()
end = timezone.now()
self.end = end
self.save()

View File

@ -48,14 +48,16 @@
role="button"><i class="fa fa-trash" aria-hidden="true"></i></a>
{% endif %}
{% if object.active and perms.core.change_timer %}
{% if perms.core.change_timer %}
<a class="btn btn-secondary"
href="{% url 'timer-restart' timer.id %}"
role="button"><i class="fa fa-refresh" aria-hidden="true"></i></a>
<a class="btn btn-warning"
href="{% url 'timer-stop' timer.id %}"
role="button"><i class="fa fa-stop" aria-hidden="true"></i></a>
{% if object.active %}
<a class="btn btn-warning"
href="{% url 'timer-stop' timer.id %}"
role="button"><i class="fa fa-stop" aria-hidden="true"></i></a>
{% endif %}
{% endif %}
</div>