Пример #1
0
 def _update_resources(self, resources_instance, validated_data):
     if self._has_resources(validated_data):
         resources = JobResourcesSerializer(instance=resources_instance,
                                            data=self._get_resources(validated_data))
         resources.is_valid(raise_exception=True)
         return resources.save()
     return None
Пример #2
0
 def _create_resources(self, validated_data):
     if self._has_resources(validated_data):
         resources = JobResourcesSerializer(
             data=self._get_resources(validated_data))
         resources.is_valid(raise_exception=True)
         return resources.save()
     return None