Ejemplo n.º 1
0
    def handle(self, request, data):
        try:
            instance_id = data['instance_id']
            class_name = data['class_name']

            class_params = self.populate_params_of_the_class(instance_id, class_name)
            [class_params.update({param:data[param]}) for param in class_params.keys()]
            utils.set_enc_metadata(self.request, instance_id, class_name, class_params)
            messages.success(request,_('Class was successfully updated.'))
            response = HttpResponse()
            return response
        except Exception:
            exceptions.handle(request,_('Unable to add metadata.'))
Ejemplo n.º 2
0
    def handle(self, request, data):
        try:
            instance_id = data['instance_id']
            class_name = data['classes']

            class_params = self.populate_args_choices()
            class_params = class_params[class_name]
            [class_params.update({param:data[class_name + param]}) for param in class_params.keys()]
            utils.set_enc_metadata(self.request, instance_id, class_name, class_params)
            messages.success(request, _('New class was successfully added.'))
            return True
        except Exception:
            exceptions.handle(request,_('Unable to add metadata.'))