Various fixes, AI

This commit is contained in:
2026-03-31 21:50:30 +02:00
parent 372da3caa9
commit de1fa76e40
5 changed files with 29 additions and 13 deletions

View File

@@ -37,7 +37,7 @@ EMAIL_USE_TLS = False
# Hosts/domain names that are valid for this site; required if DEBUG is False
ALLOWED_HOSTS = ["localhost", "127.0.0.1", ".blechreiz.com", ".bauer.technology"]
ALLOWED_HOSTS = ["localhost", "127.0.0.1", ".blechreiz.com", ".bauer.technology", ".bauer.tech"]
# Local time zone for this installation.
TIME_ZONE = "Europe/Berlin"
@@ -119,6 +119,7 @@ TEMPLATES = [
"django.template.context_processors.media",
"django.template.context_processors.static",
"sekizai.context_processors.sekizai",
"blechreiz.context_processors.google_maps",
],
},
},
@@ -170,6 +171,12 @@ GCAL_COUPLING = {
}
# Google Maps API Key
# Get your API key from https://console.cloud.google.com/apis/credentials
# Enable the Maps JavaScript API and Geocoding API
GOOGLE_MAPS_API_KEY = "AIzaSyCf9Lm5ckjmVd08scTOd7fB1dC_UCoumKg"
# Crispy Forms configuration
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"

View File

@@ -9,7 +9,7 @@ object: {{route.event}} {% endcomment %} {% load sekizai_tags static %}
/>{% endaddtoblock %} {% addtoblock "js" strip %}
<script
type="text/javascript"
src="//maps.google.com/maps/api/js?sensor=false&amp;language=de"
src="https://maps.googleapis.com/maps/api/js?key={{ GOOGLE_MAPS_API_KEY }}&amp;language=de"
></script>
{% endaddtoblock %} {% addtoblock "js" %}
<script type="text/javascript">

View File

@@ -8,6 +8,8 @@ urlpatterns = [
path("", views.eventplanning, name="eventplanning"),
path("grid/", views.events_grid, name="events_grid"),
path("delete/<int:pk>/", views.deleteEvent, name="delete_event"),
# Event detail/update views - support both URL patterns
path("<int:pk>/", views.EventUpdate.as_view(), name="event_detail"),
path("event/<int:pk>/", views.EventUpdate.as_view(), name="event_update"),
path("event/create/", views.EventCreate.as_view(), name="event_create"),
# API endpoints

View File

@@ -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)
@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 - you may need to add an API key
"https://maps.google.com/maps/api/js?language=de",
# Google Maps API with API key
maps_url,
"js/bindWithDelay.js",
"location_field/form.js",
)
)

View File

@@ -68,7 +68,7 @@
<div class="span12">
<div class="row copyright">
<div class="span12">
© 2014 Blechreiz, Martin Bauer
© 2026 Blechreiz, Martin Bauer
</div>
</div>
</div>