You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
konova/api/views/v1/intervention.py

30 lines
1.0 KiB
Python

"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 21.01.22
"""
from django.db.models import QuerySet
from api.views.v1.views import AbstractModelAPIViewV1
from intervention.models import Intervention
class APIInterventionViewV1(AbstractModelAPIViewV1):
model = Intervention
def compensations_to_json(self, qs: QuerySet):
return list(
qs.values(
"id", "identifier", "title"
)
)
def extend_properties_data(self, entry):
self.properties_data["responsible"] = self.responsible_to_json(entry.responsible)
self.properties_data["legal"] = self.legal_to_json(entry.legal)
self.properties_data["compensations"] = self.compensations_to_json(entry.compensations.all())
self.properties_data["payments"] = self.payments_to_json(entry.payments.all())
self.properties_data["deductions"] = self.deductions_to_json(entry.deductions.all())