diff --git a/blechreiz/database.sqlite b/blechreiz/database.sqlite index 4568dc0..5519846 100644 Binary files a/blechreiz/database.sqlite and b/blechreiz/database.sqlite differ diff --git a/eventplanner/templates/eventplanner/event_update_form.html b/eventplanner/templates/eventplanner/event_update_form.html index a5f7334..63851b1 100644 --- a/eventplanner/templates/eventplanner/event_update_form.html +++ b/eventplanner/templates/eventplanner/event_update_form.html @@ -16,6 +16,8 @@ {% block content %} +{{ form.media }} +
diff --git a/eventplanner/views.py b/eventplanner/views.py index 8b3c1a7..b45c417 100644 --- a/eventplanner/views.py +++ b/eventplanner/views.py @@ -111,6 +111,7 @@ def deleteEvent( request, pk ): from django.views.generic.edit import UpdateView, CreateView +from location_field.widgets import LocationWidget class EventForm( ModelForm ): def __init__(self, *args, **kwargs): @@ -121,10 +122,11 @@ class EventForm( ModelForm ): class Meta: model = Event - fields= ['title', 'type', 'date','time', 'meeting_time', 'location', 'desc', ] + fields= [ 'type', 'title', 'date','time', 'meeting_time', 'location', 'map_location', 'desc', ] widgets = { - 'location': TextInput(), + 'location' : TextInput(), + 'map_location' : LocationWidget(), } diff --git a/website/static/css/contact.css b/website/static/css/contact.css index 4dae99b..fa082e3 100644 --- a/website/static/css/contact.css +++ b/website/static/css/contact.css @@ -89,7 +89,7 @@ box-shadow: 0 0 7px 0 rgba(26, 26, 26, 0.4); padding: 33px 0 33px; background: white; - top: 41%; + top: 70%; border-radius: 4px; } #contact .map .box_wrapp .box_cont{ @@ -166,6 +166,7 @@ box-shadow: none; border-radius: 3px; margin: 0 auto; + margin-top: 20px; display: block; width: 56%; -webkit-transition: background linear .2s, box-shadow linear .2s; diff --git a/website/templates/website/mainpage.html b/website/templates/website/mainpage.html index 533da2b..ea346eb 100644 --- a/website/templates/website/mainpage.html +++ b/website/templates/website/mainpage.html @@ -41,6 +41,7 @@ } + {% endaddtoblock %} @@ -74,6 +75,7 @@ {% addtoblock "css" strip %}{% endaddtoblock %} {% addtoblock "css" strip %}{% endaddtoblock %} + {% addtoblock "css" strip %}{% endaddtoblock %} {% if event %} @@ -159,5 +161,103 @@
{% endif %} + + + + {% addtoblock "js" %} + + + + {% if hasNextConcertInfo %} + + {% endif %} + + {% endaddtoblock %} + + + + {% addtoblock "css" %} + + {% endaddtoblock %} + + {% if hasNextConcertInfo %} +
+
+ +
+
+
+
+
+
Fahrt zum Konzert:
+
+ Nächstes Konzert ist in {{nextConcert.location}} am {{nextConcert.date}} um {{nextConcert.time | time:"H:i" }}
+ {% if nextConcert.meeting_time %} Treffpunkt ist um {{ nextConcert.meeting_time | time:"H:i" }}
{% endif %} + + + + +
Fahrzeit:
Strecke:
+ Schliessen +
+
+
+ +
+
+ {% endif %} + + + + {% endblock %} diff --git a/website/views.py b/website/views.py index 308ee6d..75df1e9 100644 --- a/website/views.py +++ b/website/views.py @@ -11,6 +11,7 @@ from django.contrib.auth.decorators import login_required from eventplanner.models import Event, EventParticipation +from musicians.models import Musician from datetime import datetime @@ -34,7 +35,29 @@ def home_view(request): context['participation'] = part[0].status else: context['hasParticipationSetForAllEvents'] = True - + + + + nextConcerts = Event.objects.filter( date__gte = datetime.now(), type = 'Conc' ).order_by('date')[:1] + if len( nextConcerts) > 0 : + nextConcert = nextConcerts[0] + + routeInfo = dict() + + user = Musician.objects.get( user = request.user ); + routeInfo['origin'] = user.street + ", " + str( user.zip_code ) + " " + user.city + + if nextConcert.map_location: + # map_location has format "lat,longitute,zoomlevel" + routeInfo['destination'] = ",".join( nextConcert.map_location.split(",")[:2] ) + else: + routeInfo['destination'] = nextConcert.location + + context['routeInfo'] = routeInfo + context['nextConcert'] = nextConcert + context['hasNextConcertInfo'] = True + else: + context['hasNextConcertInfo'] = False return render( request, 'website/mainpage.html', context )