Various fixes, AI
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.forms import widgets
|
||||
from django.utils.safestring import mark_safe
|
||||
|
||||
@@ -54,14 +55,20 @@ class LocationWidget(widgets.TextInput):
|
||||
|
||||
return mark_safe(text_input + html)
|
||||
|
||||
class Media:
|
||||
css = {"all": ("location_field/form.css",)}
|
||||
js = (
|
||||
# jQuery and jQuery UI (consider using local copies or newer CDN)
|
||||
"https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js",
|
||||
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js",
|
||||
# Google Maps API - you may need to add an API key
|
||||
"https://maps.google.com/maps/api/js?language=de",
|
||||
"js/bindWithDelay.js",
|
||||
"location_field/form.js",
|
||||
@property
|
||||
def media(self):
|
||||
api_key = getattr(settings, "GOOGLE_MAPS_API_KEY", "")
|
||||
maps_url = f"https://maps.googleapis.com/maps/api/js?key={api_key}&language=de"
|
||||
|
||||
return widgets.Media(
|
||||
css={"all": ("location_field/form.css",)},
|
||||
js=(
|
||||
# jQuery and jQuery UI
|
||||
"https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js",
|
||||
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js",
|
||||
# Google Maps API with API key
|
||||
maps_url,
|
||||
"js/bindWithDelay.js",
|
||||
"location_field/form.js",
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user