0

I have been trying to style the GeoDjango OSMWidget (for Polygon drawing) for ages but can't work out how to make it flexible. Setting the map width and map height is all fine for a fixed page size but what happens if someone snaps their browser window to half-screen? A fixed map width does not react to these changes and becomes an unwieldily feature so fast it's painful. The widgets also don't respond to any style information given in the html doc via Tailwind.

Here is what the GeoDjango documentation suggests for widget styling:

widgets = {
            'geometry': forms.OSMWidget(attrs={ 
                'map_width': 1000, 
                'map_height': 400, 
                'default_zoom': 7.5 }),
        }

Other widgets, such as forms.Select have the option for a style attribute where custom css can be defined. The map widgets ignore this completely.

How can I force this map widget to respond to my css demands? I want flexible widgets, goddamit!

*Bonus points for integration with tailwind

obrunt
  • 125
  • 7

0 Answers0