Self hosted FLOSS fitness/workout, nutrition and weight tracker
Add ordering information to m2m set data
Roland Geidere39829869a96
diff --git a/requirements.txt b/requirements.txtindex c76f608e7..9eec2e0c0 100644--- a/requirements.txt+++ b/requirements.txt@@ -15,6 +15,7 @@ django_compressoricalendardjango-bootstrap-breadcrumbssphinx+django-sortedm2m# REST APIdjangorestframework==2.3.13diff --git a/wger/manager/migrations/0002_auto_20150202_2040.py b/wger/manager/migrations/0002_auto_20150202_2040.pynew file mode 100644index 000000000..3741081c0--- /dev/null+++ b/wger/manager/migrations/0002_auto_20150202_2040.py@@ -0,0 +1,22 @@+# -*- coding: utf-8 -*-+from __future__ import unicode_literals++from django.db import models, migrations+from sortedm2m.operations import AlterSortedManyToManyField+import sortedm2m.fields+++class Migration(migrations.Migration):++ dependencies = [+ ('manager', '0001_initial'),+ ]++ operations = [+ AlterSortedManyToManyField(+ model_name='set',+ name='exercises',+ field=sortedm2m.fields.SortedManyToManyField(help_text=None, to='exercises.Exercise', verbose_name='Exercises'),+ preserve_default=True,+ )+ ]diff --git a/wger/manager/models.py b/wger/manager/models.pyindex c842746f7..fdb29df5b 100644--- a/wger/manager/models.py+++ b/wger/manager/models.py@@ -29,6 +29,7 @@ from django.core.exceptions import ObjectDoesNotExistfrom django.core.exceptions import ValidationErrorfrom django.core.cache import cachefrom django.core.validators import MinValueValidator+from sortedm2m.fields import SortedManyToManyFieldfrom wger.core.models import DaysOfWeekfrom wger.exercises.models import Exercise@@ -508,8 +509,8 @@ class Set(models.Model):exerciseday = models.ForeignKey(Day,verbose_name=_('Exercise day'))- exercises = models.ManyToManyField(Exercise,- verbose_name=_('Exercises'))+ exercises = SortedManyToManyField(Exercise,+ verbose_name=_('Exercises'))order = models.IntegerField(blank=True,null=True,verbose_name=_('Order'))