US #55: Custom fields - Exclude id in CustomAttributesValues serializers
parent
5eddda9803
commit
df8c532cbd
|
@ -363,6 +363,9 @@ class BaseCustomAttributesValuesExportSerializer(serializers.ModelSerializer):
|
||||||
_custom_attribute_model = None
|
_custom_attribute_model = None
|
||||||
_container_field = None
|
_container_field = None
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
exclude = ("id",)
|
||||||
|
|
||||||
def validate_attributes_values(self, attrs, source):
|
def validate_attributes_values(self, attrs, source):
|
||||||
# values must be a dict
|
# values must be a dict
|
||||||
data_values = attrs.get("attributes_values", None)
|
data_values = attrs.get("attributes_values", None)
|
||||||
|
@ -394,27 +397,24 @@ class UserStoryCustomAttributesValuesExportSerializer(BaseCustomAttributesValues
|
||||||
_container_model = "userstories.UserStory"
|
_container_model = "userstories.UserStory"
|
||||||
_container_field = "user_story"
|
_container_field = "user_story"
|
||||||
|
|
||||||
class Meta:
|
class Meta(BaseCustomAttributesValuesExportSerializer.Meta):
|
||||||
model = custom_attributes_models.UserStoryCustomAttributesValues
|
model = custom_attributes_models.UserStoryCustomAttributesValues
|
||||||
exclude = ("id",)
|
|
||||||
|
|
||||||
|
|
||||||
class TaskCustomAttributesValuesExportSerializer(BaseCustomAttributesValuesExportSerializer):
|
class TaskCustomAttributesValuesExportSerializer(BaseCustomAttributesValuesExportSerializer):
|
||||||
_custom_attribute_model = custom_attributes_models.TaskCustomAttribute
|
_custom_attribute_model = custom_attributes_models.TaskCustomAttribute
|
||||||
_container_field = "task"
|
_container_field = "task"
|
||||||
|
|
||||||
class Meta:
|
class Meta(BaseCustomAttributesValuesExportSerializer.Meta):
|
||||||
model = custom_attributes_models.TaskCustomAttributesValues
|
model = custom_attributes_models.TaskCustomAttributesValues
|
||||||
exclude = ("id",)
|
|
||||||
|
|
||||||
|
|
||||||
class IssueCustomAttributesValuesExportSerializer(BaseCustomAttributesValuesExportSerializer):
|
class IssueCustomAttributesValuesExportSerializer(BaseCustomAttributesValuesExportSerializer):
|
||||||
_custom_attribute_model = custom_attributes_models.IssueCustomAttribute
|
_custom_attribute_model = custom_attributes_models.IssueCustomAttribute
|
||||||
_container_field = "issue"
|
_container_field = "issue"
|
||||||
|
|
||||||
class Meta:
|
class Meta(BaseCustomAttributesValuesExportSerializer.Meta):
|
||||||
model = custom_attributes_models.IssueCustomAttributesValues
|
model = custom_attributes_models.IssueCustomAttributesValues
|
||||||
exclude = ("id",)
|
|
||||||
|
|
||||||
|
|
||||||
class MembershipExportSerializer(serializers.ModelSerializer):
|
class MembershipExportSerializer(serializers.ModelSerializer):
|
||||||
|
|
|
@ -80,6 +80,9 @@ class BaseCustomAttributesValuesSerializer(ModelSerializer):
|
||||||
_custom_attribute_model = None
|
_custom_attribute_model = None
|
||||||
_container_field = None
|
_container_field = None
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
exclude = ("id",)
|
||||||
|
|
||||||
def validate_attributes_values(self, attrs, source):
|
def validate_attributes_values(self, attrs, source):
|
||||||
# values must be a dict
|
# values must be a dict
|
||||||
data_values = attrs.get("attributes_values", None)
|
data_values = attrs.get("attributes_values", None)
|
||||||
|
@ -112,7 +115,7 @@ class UserStoryCustomAttributesValuesSerializer(BaseCustomAttributesValuesSerial
|
||||||
_container_model = "userstories.UserStory"
|
_container_model = "userstories.UserStory"
|
||||||
_container_field = "user_story"
|
_container_field = "user_story"
|
||||||
|
|
||||||
class Meta:
|
class Meta(BaseCustomAttributesValuesSerializer.Meta):
|
||||||
model = models.UserStoryCustomAttributesValues
|
model = models.UserStoryCustomAttributesValues
|
||||||
|
|
||||||
|
|
||||||
|
@ -120,7 +123,7 @@ class TaskCustomAttributesValuesSerializer(BaseCustomAttributesValuesSerializer,
|
||||||
_custom_attribute_model = models.TaskCustomAttribute
|
_custom_attribute_model = models.TaskCustomAttribute
|
||||||
_container_field = "task"
|
_container_field = "task"
|
||||||
|
|
||||||
class Meta:
|
class Meta(BaseCustomAttributesValuesSerializer.Meta):
|
||||||
model = models.TaskCustomAttributesValues
|
model = models.TaskCustomAttributesValues
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,5 +131,5 @@ class IssueCustomAttributesValuesSerializer(BaseCustomAttributesValuesSerializer
|
||||||
_custom_attribute_model = models.IssueCustomAttribute
|
_custom_attribute_model = models.IssueCustomAttribute
|
||||||
_container_field = "issue"
|
_container_field = "issue"
|
||||||
|
|
||||||
class Meta:
|
class Meta(BaseCustomAttributesValuesSerializer.Meta):
|
||||||
model = models.IssueCustomAttributesValues
|
model = models.IssueCustomAttributesValues
|
||||||
|
|
Loading…
Reference in New Issue