-
Notifications
You must be signed in to change notification settings - Fork 281
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
plugins for admin? #105
Comments
Thanks for considering to contribute :) Sorry for the delay. It looks like the guyz at Makina Corpus are busy those days :) Regarding the inclusion of custom script in forms, you can try this (untested): LEAFLET_CONFIG = {
'PLUGINS': {
'forms': {
'js': ['vendors/Leaflet.Coordinates.js', 'yourapp/script.js']
'auto-include': True
}
}
} In $(window).on('map:init', function (e) {
var detail = e.originalEvent ?
e.originalEvent.detail : e.detail;
...
// Play with Leaflet.Coordinates
L.marker([50.5, 30.5]).addTo(detail.map);
...
// Optional specific behaviour for particular field
map.on('map:loadfield', function (ev) {
...
// Customize map for field
console.log(ev.field, ev.fieldid);
...
});
}); Good luck! |
Any news to share ? |
Hi ! This works indeed. But is there a way to load only specific plugins for specific fields ? Here I'm trying to display the other features around the edited feature in the admin widget (I intend to allow to snap to those other features). I managed to create a geojson overlayer layer by creating a custom plugin.
But I can't find how to add that plugin to a specific widget. It seems the only way is to add the plugin to
This results in adding the layer in all my widgets. But that overlay only makes sense in a specific field ! I was expecting something like :
or the ability to define plugins in LeafletWidget (so that I could override my widgets). Is this possible ? Thanks ! Olivier |
It is not impossible, but not available out of the box :( When you say type of field, you mean geometry type? |
I am trying to load plugin as it's present in the doc but no result. I want to load the same plugin Leaflet.Coordinates in my admin LeafletgeoAdmin widget. Sorry, I should miss something but I don't know what ? thanks a lot for your share |
well done, I fix my trouble by using 'forms' otherwise the 'name of the coordinate plugins' sorry for the noise |
this issue is currently giving me grief, and after much work porting mapentity to python 3 and django 1.9 it feels pretty irritating to be stumped by admin templating of a JS library plugins. Could we get some clear direction as to either the 'right way' to solve this, or acknowledgement that this is indeed a missing feature? |
Ok, I've found the cause of all the trouble. The media method is 'naive', it explicitly passes the base leaflet JavaScript, plus the JavaScript and CSS defined in I don't have a PR handy at the moment, but I do have working code. Which I am using with a custom template that overrides the I'll try and find time to fork the repo and write a PR. |
Great!
I completely understand, and feel sorry for that. As I said ealier and elsewhere, I cannot maintain this library anymore. I wrote it while I was working at makina corpus, and haven't used it since I left. The new team seems pretty busy and it looks like they can't take time to review/comment/help... |
I'm using django-leaflet for admin only right now and I'd like to have a plugin like Leaflet.Coordinates available for adding points.
My programming skills are limited, but I'd like to try to add plugin functionality to the admin site. Needless to say, I have no idea where to start. Could you point me to an example? It would be great if I could contribute something.
The text was updated successfully, but these errors were encountered: