Self hosted FLOSS fitness/workout, nutrition and weight tracker
Set the default ordering ordering for TrainingSchedule and show all of them in the overview, not only the last 5
Roland Geidere451d1d34ae0
diff --git a/manager/models.py b/manager/models.pyindex 9f477417d..7767d1c39 100644--- a/manager/models.py+++ b/manager/models.py@@ -38,6 +38,12 @@ DAYS_OF_WEEK_CHOICES = [(1, _('Monday')),class TrainingSchedule(models.Model):"""Model for a training schedule"""++ # Metaclass to set some other properties+ class Meta:+ ordering = ["-creation_date", ]++creation_date = models.DateField(_('Creation date'), auto_now_add=True)comment = models.TextField(verbose_name = _('Description'),max_length=100,diff --git a/manager/views.py b/manager/views.pyindex 802eea3a3..005ee336b 100644--- a/manager/views.py+++ b/manager/views.py@@ -240,7 +240,7 @@ def overview(request):template_data = {}template_data['active_tab'] = 'workout'- latest_trainings = TrainingSchedule.objects.filter(user=request.user).order_by('-creation_date')[:5]+ latest_trainings = TrainingSchedule.objects.filter(user=request.user)template_data['workouts'] = latest_trainingsreturn render_to_response('workout/overview.html',