Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin Widget don't show draw tools when minimap is active #315

Open
cantin-f opened this issue Feb 20, 2021 · 0 comments
Open

Admin Widget don't show draw tools when minimap is active #315

cantin-f opened this issue Feb 20, 2021 · 0 comments

Comments

@cantin-f
Copy link

cantin-f commented Feb 20, 2021

Hi,

I'm playing with django-leaflet and django-geojson.
The map is working great on the public website (https://nacros.eu.pythonanywhere.com/map), I'm trying to make it works in the admin.
In the admin, the map show for a PointField but it's a normal map without draw tools.

django-leaflet==0.27.1
python==3.7
django==3.1.7

Models :

class POI(models.Model):
    name = models.CharField(max_length=64)
    geom = PointField()

Admin :

admin.site.register(POI, LeafletGeoAdmin)

settings :

LEAFLET_CONFIG = {
    'DEFAULT_CENTER': (-5.0, -57.0),
    'DEFAULT_ZOOM': 6,
    'MIN_ZOOM': 4,
    'MAX_ZOOM': 8,
    'TILES': '/static/map/{z}/{y}/{x}.jpg',
    'ATTRIBUTION_PREFIX': '© Virtys',
    'SCALE': None,
    'MINIMAP': True,
    'PLUGINS': {
        'MousePosition': {
            'css': '/static/assets/mldb/map/L.Control.MousePosition.css',
            'js': 'assets/mldb/map/L.Control.MousePosition.js',
            'auto-include': True,
        },
        'FullScreen': {
            'css': 'https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/leaflet.fullscreen.css',
            'js': 'https://api.mapbox.com/mapbox.js/plugins/leaflet-fullscreen/v1.0.1/Leaflet.fullscreen.min.js',
            'auto-include': True,
        },
    }
}

Admin view :

image

I have one javascript error that is related :

leaflet.extras.js:186 Uncaught TypeError: L.Control.MiniMap is not a constructor
    at i.<anonymous> (leaflet.extras.js:186)
    at i.whenReady (leaflet.js:5)
    at i._djSetupControls (leaflet.extras.js:185)
    at initialize (leaflet.extras.js:68)
    at new i (leaflet.js:5)
    at Function.L.Map.djangoMap (leaflet.extras.js:211)
    at loadmap ((index):500)

If I turn off the minimap in settings, draw tools appear. So the problem is the minimap in admin widget.

Thx for your help.

@cantin-f cantin-f changed the title Admin Widget don't show draw tools Admin Widget don't show draw tools when minimap is active Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant