fix base message serializer

This commit is contained in:
Matthias 2021-11-29 00:17:00 +01:00
parent 2747d0d609
commit f9655f5eac
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -98,14 +98,14 @@ class UserSettingsSerializer(SettingsSerializer):
]
class NotificationMessageSerializer(SettingsSerializer):
class NotificationMessageSerializer(InvenTreeModelSerializer):
"""
Serializer for the InvenTreeUserSetting model
"""
target = serializers.SerializerMethodField()
target = serializers.SerializerMethodField(read_only=True)
source = serializers.SerializerMethodField()
source = serializers.SerializerMethodField(read_only=True)
user = serializers.PrimaryKeyRelatedField(read_only=True)
@ -117,11 +117,11 @@ class NotificationMessageSerializer(SettingsSerializer):
creation = serializers.CharField(read_only=True)
age = serializers.IntegerField()
age = serializers.IntegerField(read_only=True)
age_human = serializers.CharField()
age_human = serializers.CharField(read_only=True)
read = serializers.BooleanField()
read = serializers.BooleanField(read_only=True)
def get_target(self, obj):
return get_objectreference(obj, 'target_content_type', 'target_object_id')