24 lines
964 B
Python
24 lines
964 B
Python
|
from rest_framework import serializers
|
||
|
|
||
|
from authentication.models import ExtendedUser
|
||
|
from inventory.models import Event
|
||
|
from tickets.models import IssueThread, ItemRelation
|
||
|
|
||
|
|
||
|
class RelationSerializer(serializers.ModelSerializer):
|
||
|
class Meta:
|
||
|
model = ItemRelation
|
||
|
fields = ('id', 'status', 'timestamp', 'item', 'issue_thread')
|
||
|
|
||
|
|
||
|
class BasicIssueSerializer(serializers.ModelSerializer):
|
||
|
assigned_to = serializers.SlugRelatedField(slug_field='username', queryset=ExtendedUser.objects.all(),
|
||
|
allow_null=True, required=False)
|
||
|
event = serializers.SlugRelatedField(slug_field='slug', queryset=Event.objects.all(),
|
||
|
allow_null=True, required=False)
|
||
|
|
||
|
class Meta:
|
||
|
model = IssueThread
|
||
|
fields = ('id', 'name', 'state', 'assigned_to', 'uuid', 'event')
|
||
|
read_only_fields = ('id', 'timeline', 'last_activity', 'uuid', 'related_items')
|