Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Set the default order of Exercises and Categories

Roland Geiderfbae562a5ad9
diff --git a/manager/models.py b/manager/models.py
index a84efbd3b..0e12bdfe4 100644
--- a/manager/models.py
+++ b/manager/models.py
@@ -60,8 +60,10 @@ class ExerciseCategory(models.Model):
"""
name = models.CharField(_('Name'), max_length=100)
+ # Metaclass to set some other properties
class Meta:
verbose_name_plural = _("Exercise Categories")
+ ordering = ["name", ]
def __unicode__(self):
"""Return a more human-readable representation
@@ -76,13 +78,15 @@ class Exercise(models.Model):
category = models.ForeignKey(ExerciseCategory, verbose_name = _('Category'))
name = models.CharField(max_length=200, verbose_name = _('Name'))
+ # Metaclass to set some other properties
+ class Meta:
+ ordering = ["name", ]
+
def __unicode__(self):
"""Return a more human-readable representation
"""
return self.name
-
-
class ExerciseComment(models.Model):
"""Model for an exercise comment
"""