Don't ask for the transformation order when one is being created.
This commit is contained in:
@@ -38,7 +38,9 @@ class Transformation(models.Model):
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.order:
|
||||
self.order = Transformation.objects.filter(content_type=self.content_type, object_id=self.object_id).aggregate(Max('order'))['order__max'] + 1
|
||||
last_order = Transformation.objects.filter(content_type=self.content_type, object_id=self.object_id).aggregate(Max('order'))['order__max']
|
||||
if last_order is not None:
|
||||
self.order = last_order + 1
|
||||
super(Transformation, self).save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
|
||||
@@ -55,7 +55,7 @@ class TransformationDeleteView(SingleObjectDeleteView):
|
||||
|
||||
|
||||
class TransformationCreateView(SingleObjectCreateView):
|
||||
fields = ('name', 'arguments', 'order')
|
||||
fields = ('name', 'arguments')
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
content_type = get_object_or_404(ContentType, app_label=self.kwargs['app_label'], model=self.kwargs['model'])
|
||||
|
||||
Reference in New Issue
Block a user