Compare commits
4 Commits
d65f60c07c
...
1.17
| Author | SHA1 | Date | |
|---|---|---|---|
| c795d22e68 | |||
| 591527b048 | |||
| 3de6a905e1 | |||
| 9632e59456 |
@@ -88,6 +88,11 @@ class CompensationAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensa
|
|||||||
# Nothing to do here
|
# Nothing to do here
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
# Transform a potential external identifier into an internal one
|
||||||
|
intervention_ext_id = self._get_external_identifier(intervention_id)
|
||||||
|
if intervention_ext_id:
|
||||||
|
intervention_id = intervention_ext_id.internal_id
|
||||||
|
|
||||||
intervention = Intervention.objects.get(
|
intervention = Intervention.objects.get(
|
||||||
id=intervention_id,
|
id=intervention_id,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -62,6 +62,14 @@ class DeductionAPISerializerV1(AbstractModelAPISerializerV1,
|
|||||||
if surface <= 0:
|
if surface <= 0:
|
||||||
raise ValueError("Surface must be > 0 m²")
|
raise ValueError("Surface must be > 0 m²")
|
||||||
|
|
||||||
|
# Check if external identifiers need to be mapped onto internal ones
|
||||||
|
acc_ext_id = self._get_external_identifier(acc_id)
|
||||||
|
intervention_ext_id = self._get_external_identifier(intervention_id)
|
||||||
|
if acc_ext_id:
|
||||||
|
acc_id = acc_ext_id.internal_id
|
||||||
|
if intervention_ext_id:
|
||||||
|
intervention_id = intervention_ext_id.internal_id
|
||||||
|
|
||||||
acc = EcoAccount.objects.get(
|
acc = EcoAccount.objects.get(
|
||||||
id=acc_id,
|
id=acc_id,
|
||||||
deleted__isnull=True,
|
deleted__isnull=True,
|
||||||
|
|||||||
@@ -40,12 +40,20 @@ class AbstractModelAPISerializerV1(AbstractModelAPISerializer):
|
|||||||
else:
|
else:
|
||||||
geom = MultiPolygon().geojson
|
geom = MultiPolygon().geojson
|
||||||
geo_json = json.loads(geom)
|
geo_json = json.loads(geom)
|
||||||
|
ext_ids = list(
|
||||||
|
ExternalIdentifier.objects.filter(
|
||||||
|
internal_id=entry.id
|
||||||
|
).values_list(
|
||||||
|
"external_id", flat=True
|
||||||
|
)
|
||||||
|
)
|
||||||
self.properties_data = {
|
self.properties_data = {
|
||||||
"id": entry.id,
|
"id": entry.id,
|
||||||
"identifier": entry.identifier,
|
"identifier": entry.identifier,
|
||||||
"title": entry.title,
|
"title": entry.title,
|
||||||
"created_on": self._created_on_to_json(entry),
|
"created_on": self._created_on_to_json(entry),
|
||||||
"modified_on": self._modified_on_to_json(entry),
|
"modified_on": self._modified_on_to_json(entry),
|
||||||
|
"external_identifiers": ext_ids,
|
||||||
}
|
}
|
||||||
self._extend_properties_data(entry)
|
self._extend_properties_data(entry)
|
||||||
geo_json["properties"] = self.properties_data
|
geo_json["properties"] = self.properties_data
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
{% for rpp_option in table.results_per_page_choices %}
|
{% for rpp_option in table.results_per_page_choices %}
|
||||||
<a class="dropdown-item {% if table.results_per_page_chosen == rpp_option %}selected{% endif %}" href="{% querystring table.results_per_page_parameter=rpp_option %}">
|
<a class="dropdown-item {% if table.results_per_page_chosen == rpp_option %}selected{% endif %}" href="{% querystring %}&{{ table.results_per_page_parameter}}={{rpp_option }}">
|
||||||
{{ rpp_option }}
|
{{ rpp_option }}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user