US #55: Custom fields - Exclude id in CustomAttributesValues serializers

remotes/origin/enhancement/email-actions
David Barragán Merino 2015-02-18 15:45:01 +01:00
parent 5eddda9803
commit df8c532cbd
2 changed files with 12 additions and 9 deletions

View File

@ -363,6 +363,9 @@ class BaseCustomAttributesValuesExportSerializer(serializers.ModelSerializer):
_custom_attribute_model = None
_container_field = None
class Meta:
exclude = ("id",)
def validate_attributes_values(self, attrs, source):
# values must be a dict
data_values = attrs.get("attributes_values", None)
@ -394,27 +397,24 @@ class UserStoryCustomAttributesValuesExportSerializer(BaseCustomAttributesValues
_container_model = "userstories.UserStory"
_container_field = "user_story"
class Meta:
class Meta(BaseCustomAttributesValuesExportSerializer.Meta):
model = custom_attributes_models.UserStoryCustomAttributesValues
exclude = ("id",)
class TaskCustomAttributesValuesExportSerializer(BaseCustomAttributesValuesExportSerializer):
_custom_attribute_model = custom_attributes_models.TaskCustomAttribute
_container_field = "task"
class Meta:
class Meta(BaseCustomAttributesValuesExportSerializer.Meta):
model = custom_attributes_models.TaskCustomAttributesValues
exclude = ("id",)
class IssueCustomAttributesValuesExportSerializer(BaseCustomAttributesValuesExportSerializer):
_custom_attribute_model = custom_attributes_models.IssueCustomAttribute
_container_field = "issue"
class Meta:
class Meta(BaseCustomAttributesValuesExportSerializer.Meta):
model = custom_attributes_models.IssueCustomAttributesValues
exclude = ("id",)
class MembershipExportSerializer(serializers.ModelSerializer):

View File

@ -80,6 +80,9 @@ class BaseCustomAttributesValuesSerializer(ModelSerializer):
_custom_attribute_model = None
_container_field = None
class Meta:
exclude = ("id",)
def validate_attributes_values(self, attrs, source):
# values must be a dict
data_values = attrs.get("attributes_values", None)
@ -112,7 +115,7 @@ class UserStoryCustomAttributesValuesSerializer(BaseCustomAttributesValuesSerial
_container_model = "userstories.UserStory"
_container_field = "user_story"
class Meta:
class Meta(BaseCustomAttributesValuesSerializer.Meta):
model = models.UserStoryCustomAttributesValues
@ -120,7 +123,7 @@ class TaskCustomAttributesValuesSerializer(BaseCustomAttributesValuesSerializer,
_custom_attribute_model = models.TaskCustomAttribute
_container_field = "task"
class Meta:
class Meta(BaseCustomAttributesValuesSerializer.Meta):
model = models.TaskCustomAttributesValues
@ -128,5 +131,5 @@ class IssueCustomAttributesValuesSerializer(BaseCustomAttributesValuesSerializer
_custom_attribute_model = models.IssueCustomAttribute
_container_field = "issue"
class Meta:
class Meta(BaseCustomAttributesValuesSerializer.Meta):
model = models.IssueCustomAttributesValues