You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/customization.rst
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -197,6 +197,34 @@ The second way overrides these templates for all your models.
197
197
you need to create a sub-directory named ``mapentity`` in ``main/templates``.
198
198
Then you can create a file named ``override_detail_pdf.html``(or ``.css``) and it will be used for all your models if a specific template is not provided.
199
199
200
+
Popups
201
+
------
202
+
203
+
MapEntity displays a popup when clicking on a map object.
204
+
By default, it shows the object's name and a button linking to its detail page.
205
+
206
+
Configure popup fields for each model using the ``POPUP_CONTENT`` setting:
207
+
208
+
.. code-block:: python
209
+
POPUP_CONTENT= {
210
+
"museum": ["name", "city", "public"],
211
+
}
212
+
The key is the model name in lowercase (e.g., ``"museum"``), and the value is a list of field names to display.
213
+
The popup title shows the object's string representation (using `__str__()`), with the configured fields displayed below.
214
+
215
+
If there is a display function for a field in the model then it will be used in priority.
216
+
217
+
.. code-block:: python
218
+
@property
219
+
defpublic_display(self):
220
+
return"Public"ifself.public else"Not public"
221
+
If no display function exists, the field’s string representation is used by default.
222
+
223
+
Non-existent fields can be used if a display function exist.
224
+
225
+
If a model isn't configured in ``POPUP_CONTENT``, the object's string representation is used as the title.
226
+
If a specified field doesn't exist on the model, it won't be displayed. The detail page button is always shown.
227
+
If the option ``displayPopup`` is setup to false, then the popup will not appear when clicking on the feature.
0 commit comments