Open sglebs opened 1 year ago
Thank for your suggestion. Feel free to submit a PR. You can check the JSONField implementation for reference
I am studying https://jowilf.github.io/starlette-admin/advanced/custom-field/#detail-page and it seems to take only 1 field:
field: Your field instance
data: value to display
In my case, I want to build a "composite field": given N fields, show as one. lat/long as Map is an obvious one. Another obvious one is to have a single "full address" field from N columns (country/state/city,street name and number).
So, I guess the more general issue is: how can "composite fields" be added to starlet-admin?
Maybe field
could potentially be a collection of fields?
In reality we are talking about a synthetic field, computed from N fields from the entity. I may want to show raw lat&long as floats AND ALSO an interactive map widget, computed from these 2 values. I guess I want a field where I pass the whole row/entity, and not just 1 attributes. Is that supported?
You can override the BaseField.parse_obj function to handle it
I have an entity which has 2 float fields: latitude and longitude. I would like to render this as a map. Does it make sense / is it possible to use a synthetic MapField to CREATE/UPDATE/DELETE the 2 concrete fields containing latitude/longitude? Just like Dates get a nice Date Picker instead of text string, it would be cool if lat/long field pairs could get a map a la Google Maps. By dragging the map etc the lat/long would be updated.
Thanks for listening.
Upvote & Fund