#31 API basic implementation EcoAccount fetch
* outsources json creation of modified_on an created_on to superclass * adds API support for fetching ecoaccount data
This commit is contained in:
@@ -32,8 +32,6 @@ class APIInterventionViewV1(AbstractModelAPIViewV1):
|
||||
)
|
||||
|
||||
def model_to_json(self, entry: Intervention):
|
||||
modified_on = entry.modified or entry.created
|
||||
modified_on = modified_on.timestamp
|
||||
entry_json = {
|
||||
"identifier": entry.identifier,
|
||||
"title": entry.title,
|
||||
@@ -42,8 +40,8 @@ class APIInterventionViewV1(AbstractModelAPIViewV1):
|
||||
"compensations": self.compensations_to_json(entry.compensations.all()),
|
||||
"payments": self.payments_to_json(entry.payments.all()),
|
||||
"deductions": self.deductions_to_json(entry.deductions.all()),
|
||||
"modified_on": modified_on,
|
||||
"created_on": entry.created.timestamp,
|
||||
"modified_on": self.modified_on_to_json(entry),
|
||||
"created_on": self.created_on_to_json(entry),
|
||||
}
|
||||
geom = entry.geometry.geom.geojson
|
||||
geo_json = json.loads(geom)
|
||||
|
||||
Reference in New Issue
Block a user