vb64 / django.admin.geomap Goto Github PK
View Code? Open in Web Editor NEWDisplaying objects on maps in the Django views and administration site.
License: MIT License
Displaying objects on maps in the Django views and administration site.
License: MIT License
Я хочу по нажатию на объект на карте (на булавку) в другом окне показывать много свойств этого объекта. Подскажите, пожалуйста, можно это сделать (вызвать вьюху с соответствующим primary key) с помощью Вашей библиотеки? Если нет, буду признателен, если подскажете, в какую сторону читать.
Hi there,
Much appreciated! You think we could have a django_admin_geomap.ModelAdmin
as a mixin? We already use DjangoQLSearchMixin
and django_safedelete.SafeDeleteAdmin
. There is unfortunately a limit of classes that I can inherent from that are not Mixins.
First of all, thanks for such a great tool. I've got it hooked in to WhatThreeWords on my admin panel and it's working brilliantly!
I've seen the docs about setting the admin zoom and I'm wondering if it's possible to have it "auto-zoom" based on the coordinates of the objects that are returned to it?
For example, if I've only got objects that have locations in central London, is it possible to have it auto-zoom to a level where all the objects are displayed on the map at a sensible level?
When rendering the map with all its perks in the admin panel everything works flawlessly, but when doing so in the template the visualized map looks like its a screenshot with missing chunks, and doesn't allow manual zooming (the zooming effect is the same of a picture, it just gets foggy the more i zoom in).
View code:
def index(request):
return render(request, 'core/index.html', geomap_context(Location.objects.all(), map_zoom="2", auto_zoom="10", map_height="1000px"))
Template code:
I'm using django version 4.1.7
Hello!
I'm trying to implement this app in my own project, to give my admin users a satisfying overview of all the location-based entities we maintain in our database.
I will also lead with the fact that I am using the GeoItem
class in what may be a non-standard way, attaching it to an entity with a one-to-one key to a separate Location model (as I wish to see the map in admin pages for the prior entity).
The map renders like a charm in the individual change form for each entity, but I receive some strange errors in my client that seem to indicate that the JS is being generated incorrectly for the changelist-view map.
The first one I receive is Uncaught SyntaxError: Unexpected token ')' (at (index):993:15)
, and clicking through I see the following:
This seems to indicate to me that the recommended default value of the geomap_latitude
/longitude
properties (i.e., ''
) is appearing directly in this generated code. Changing this to other values like test
or NaN
seem to confirm this, but somehow the issue appears elsewhere (potentially in entities with no/null location).
The second error is Uncaught TypeError: map.addOverlay is not a function at (index):14861:5
, to which I have no answer. I don't know whether it's correlated to the first one or not.
I see that this project is still in active developent; if possible, I would love to hop on a call with a developer and figure out the issue, and I would be happy to follow up this issue with detailed comments explaining what happened, for anyone else who might encounter these problems in the future.
Thank you, and please let me know if I can supply any more information.
The pop-up window is not visible when clicking on a marker.
This is the HTML that changes when clicking an element:
<div class="popover fade bs-popover-top show" role="tooltip" id="popover906644" x-placement="top" x-out-of-boundaries="" style="position: absolute; transform: translate3d(2128px, 4041px, 0px); top: 0px; left: 0px; will-change: transform;">
<div class="arrow" style="left: 0px;">
</div><h3 class="popover-header">
</h3><div class="popover-body">ABCDEF</div></div>
The left position (2128) is too far right. When I change it manually to something smaller, then the pop-up does appears.
Looks like something is wrong with the pop-up position?
BTW, the top position (4041) looks to be correct.
Подключил по инструкции, джанго никаких ошибок не выдает. В консоли браузера есть ошибки
GEThttps://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.6.1/build/ol.js
[HTTP/2 403 Forbidden 3289ms]
GEThttps://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.6.1/css/ol.css
[HTTP/2 403 Forbidden 4311ms]
Скрипты из базового шаблона походу не доступны
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.6.1/build/ol.js"></script>Thank you very much for detailed explanation of this project.
But how do I do it if I want to render the map and get the longitude and latitude outside of the Django Admin. I want to do it on a Django template. Get the Longitude and Latitude based on user search for location.
Your resonse will be greatly appreciated.
Thanks.
When using Admin Search to filter the list of items, the map still displays all items, and not just the items that the admin filtered.
First, thanks for an excellent package! It was (fairly) easy to install, and bam! Instance maps!
I would like to point out that adding django_admin_geomap
to INSTALLED_APPS
removes the need edit ``TEMPLATES```.
I find this easier/robust because I was not able to add a template directory that supported both dev and deployment environments.
Thanks again!
Hi, I got an error when trying to delete a list of objects in admin (action).
What could be the problem?
Python - 3.8
Django - 4.1.1
django-admin-geomap - 1.4
Traceback (most recent call last):
File "/home/krot/Dev/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/krot/Dev/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/krot/Dev/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 686, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/krot/Dev/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 133, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/krot/Dev/venv/lib/python3.8/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/krot/Dev/venv/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 242, in inner
return view(request, *args, **kwargs)
File "/home/krot/Dev/venv/lib/python3.8/site-packages/django_admin_geomap/init.py", line 105, in changelist_view
change_list_queryset = response.context_data['cl'].queryset
Exception Type: KeyError at /admin/carwash/
Exception Value: 'cl'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.