Auto create transformations without arguments
These are created directly from the selection form view. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
- Fix transformation label display in transformation create view.
|
- Fix transformation label display in transformation create view.
|
||||||
- Remove supervisor environment variable expansion.
|
- Remove supervisor environment variable expansion.
|
||||||
- Don't exit GitLab makefile target if the branch to delete doesn't exist.
|
- Don't exit GitLab makefile target if the branch to delete doesn't exist.
|
||||||
|
- Automatically create transformations from the selection form that
|
||||||
|
doesn't have arguments.
|
||||||
|
|
||||||
3.3.2 (2019-12-05)
|
3.3.2 (2019-12-05)
|
||||||
==================
|
==================
|
||||||
|
|||||||
@@ -255,20 +255,45 @@ class TransformationSelectView(
|
|||||||
template_name = 'appearance/generic_form.html'
|
template_name = 'appearance/generic_form.html'
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
return HttpResponseRedirect(
|
transformation_class = BaseTransformation.get(
|
||||||
redirect_to=reverse(
|
name=form.cleaned_data['transformation']
|
||||||
viewname='converter:transformation_create',
|
|
||||||
kwargs={
|
|
||||||
'app_label': self.kwargs['app_label'],
|
|
||||||
'model': self.kwargs['model'],
|
|
||||||
'object_id': self.kwargs['object_id'],
|
|
||||||
'layer_name': self.kwargs['layer_name'],
|
|
||||||
'transformation_name': form.cleaned_data[
|
|
||||||
'transformation'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
if transformation_class.arguments:
|
||||||
|
return HttpResponseRedirect(
|
||||||
|
redirect_to=reverse(
|
||||||
|
viewname='converter:transformation_create',
|
||||||
|
kwargs={
|
||||||
|
'app_label': self.kwargs['app_label'],
|
||||||
|
'model': self.kwargs['model'],
|
||||||
|
'object_id': self.kwargs['object_id'],
|
||||||
|
'layer_name': self.kwargs['layer_name'],
|
||||||
|
'transformation_name': form.cleaned_data[
|
||||||
|
'transformation'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
layer = self.layer
|
||||||
|
content_type = self.get_content_type()
|
||||||
|
object_layer, created = ObjectLayer.objects.get_or_create(
|
||||||
|
content_type=content_type, object_id=self.external_object.pk,
|
||||||
|
stored_layer=layer.stored_layer
|
||||||
|
)
|
||||||
|
object_layer.transformations.create(
|
||||||
|
name=form.cleaned_data['transformation']
|
||||||
|
)
|
||||||
|
|
||||||
|
return HttpResponseRedirect(
|
||||||
|
redirect_to=reverse(
|
||||||
|
viewname='converter:transformation_list', kwargs={
|
||||||
|
'app_label': self.kwargs['app_label'],
|
||||||
|
'model': self.kwargs['model'],
|
||||||
|
'object_id': self.kwargs['object_id'],
|
||||||
|
'layer_name': self.kwargs['layer_name']
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def get_extra_context(self):
|
def get_extra_context(self):
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user