mirror of
https://github.com/lemeow125/EquipmentTracker-Backend.git
synced 2024-11-17 06:09:26 +08:00
Add equipment field to equipment instance log serializer to correctly identify equipment when viewing logs
This commit is contained in:
parent
53e4d8e02d
commit
1163d64c06
1 changed files with 4 additions and 2 deletions
|
@ -116,12 +116,14 @@ class EquipmentInstanceLogsSerializer(serializers.HyperlinkedModelSerializer):
|
|||
history_date = serializers.DateTimeField(
|
||||
format="%m-%d-%Y %I:%M%p", read_only=True)
|
||||
history_user = serializers.SerializerMethodField()
|
||||
equipment = serializers.PrimaryKeyRelatedField(
|
||||
source='equipment.name', queryset=Equipment.objects.all())
|
||||
|
||||
class Meta:
|
||||
model = EquipmentInstance.history.model
|
||||
fields = ('history_id', 'status', 'remarks',
|
||||
fields = ('history_id', 'id', 'equipment', 'status', 'remarks',
|
||||
'history_date', 'history_user')
|
||||
read_only_fields = ('history_id', 'id', 'status', 'remarks',
|
||||
read_only_fields = ('history_id', 'id', 'equipment', 'status', 'remarks',
|
||||
'history_date', 'history_user')
|
||||
|
||||
def get_history_user(self, obj):
|
||||
|
|
Loading…
Reference in a new issue