Commit bc720766 authored by Serial Lab's avatar Serial Lab

#2 Added support and testing for SBDH.

parent 338d54e8
Pipeline #18787504 passed with stage
in 1 minute and 46 seconds
......@@ -13,5 +13,6 @@ REST_FRAMEWORK = {
'rest_framework.parsers.MultiPartParser',
'rest_framework_xml.parsers.XMLParser',
),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 20
}
......@@ -20,6 +20,7 @@ import six
import importlib
from django.db.models import Max
from django.http.request import QueryDict
from django.apps import apps
from django.utils.translation import gettext as _
......@@ -41,6 +42,8 @@ class RegionSerializer(serializers.ModelSerializer):
'''
Establish order where there is none. :-)
'''
if isinstance(self.initial_data, QueryDict):
self.initial_data._mutable = True
regions = self.Meta.model.objects.filter(
pool__machine_name=self.initial_data.get('pool')).aggregate(
Max('order')
......
......@@ -206,7 +206,8 @@ class SequentialRegion(Region):
regions = SequentialRegion.objects.filter(pool=self.pool).aggregate(
models.Max('order')
)
self.order = regions.get('order_max', 1)
val = regions['order__max'] or 0 + 1
self.order = val + 1
def __str__(self):
'''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment