');
- var input = this;
- map.addClass("location_picker_map");
- map.attr('id', 'location_picker_map');
- $(this).css('display','none');
- var search_field = $('
');
- var search_button = $('
')
- search_field.attr('id', 'location_picker_search')
- $(this).parent().append(map);
- $(this).parent().append($('
'));
- $(this).parent().append(search_field);
- $(this).parent().append(search_button);
-
-
- if (this.value.split(',').length == 5) {
- values = this.value.split(',');
- var position = new google.maps.LatLng(values[0], values[1]);
- var center = new google.maps.LatLng(values[2], values[3]);
- var zoom = parseInt(values[4]);
- } else {
- var center = new google.maps.LatLng(49.340119,10.890325);
- var position = new google.maps.LatLng(49.340119,10.890325);
- var zoom = 17;
- this.value = position.lat()
- + ',' + position.lng()
- + ',' + center.lat()
- + ',' + center.lng()
- + ',' + zoom;
- }
-
- geocoder.geocode({'latLng': position}, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- if (results[0]) {
- document.getElementById('location_picker_search').value = results[0].formatted_address ;
- }
- }
- });
-
-
-
- var myOptions = {
- zoom: zoom,
- center: center,
- mapTypeId: google.maps.MapTypeId.HYBRID
- };
- var gmap = new google.maps.Map(document.getElementById("location_picker_map"), myOptions);
-
- if (position != null) {
- var marker = new google.maps.Marker({
- position: position,
- map: gmap,
- });
- } else {
- var marker = null;
- }
-
- function geoCode(){
- var address = document.getElementById("location_picker_search").value;
- geocoder.geocode( { 'address': address}, function(results, status) {
- if (status == google.maps.GeocoderStatus.OK) {
- var latLon = results[0].geometry.location;
- gmap.setCenter(latLon);
- if (marker == null){
- marker = new google.maps.Marker({
- position: latLon,
- map: gmap,
- });
- } else {
- marker.setPosition(latLon);
- }
- updateInput();
- } else {
- alert("Geocode was not successful for the following reason: " + status);
- }
- });
- };
- search_button.click(function() {
- result = geoCode();
- });
- search_field.bind('keydown', function(e) {
- var code = (e.keyCode ? e.keyCode : e.which);
- if (code == 13) { //Enter keycode
- geoCode();
- return false;
- }
- });
-
- function updateInput(){
- if (marker == null){
- return;
- }
- var pos = marker.getPosition();
- input.value = pos.lat()
- + ',' + pos.lng()
- + ',' + gmap.getCenter().lat()
- + ',' + gmap.getCenter().lng()
- + ',' + gmap.getZoom();
- }
- google.maps.event.addListener(gmap, 'click', function(event) {
- if (marker == null) {
- marker = new google.maps.Marker({
- position: event.latLng,
- map: gmap,
- });
- } else {
- marker.setPosition(event.latLng);
- }
- updateInput();
- });
-
- google.maps.event.addListener(gmap, 'center_changed', function(event) {
- updateInput();
- });
- google.maps.event.addListener(gmap, 'zoom_changed', function(event) {
- updateInput();
- });
-
- function HomeControl(controlDiv, gmap) {
-
- controlDiv.style.padding = '5px';
-
- // Set CSS for the control border
- var controlUI = document.createElement('DIV');
- controlUI.style.backgroundColor = 'white';
- controlUI.style.borderStyle = 'solid';
- controlUI.style.borderWidth = '1px';
- controlUI.style.cursor = 'pointer';
- controlUI.style.textAlign = 'center';
- controlUI.title = 'Click to remove the marker';
- controlDiv.appendChild(controlUI);
-
- // Set CSS for the control interior
- var controlText = document.createElement('DIV');
- controlText.style.fontFamily = 'sans-serif';
- controlText.style.fontSize = '12px';
- controlText.style.paddingLeft = '4px';
- controlText.style.paddingRight = '4px';
- controlText.innerHTML = 'Clear';
- controlUI.appendChild(controlText);
-
- // Setup the click event listeners: simply set the map to Chicago
- google.maps.event.addDomListener(controlUI, 'click', function() {
- if (marker != null){
- marker.setMap(null);
- marker = null;
- input.value = '';
- }
- });
- }
- var homeControlDiv = document.createElement('DIV');
- var homeControl = new HomeControl(homeControlDiv, gmap);
-
- homeControlDiv.index = 1;
- gmap.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
- });
-});
diff --git a/locpick/static/locpick/location_picker.css b/locpick/static/locpick/location_picker.css
deleted file mode 100644
index 90c30ee..0000000
--- a/locpick/static/locpick/location_picker.css
+++ /dev/null
@@ -1,7 +0,0 @@
-.location_picker_map {
- width: 600px;
- height: 400px;
- border: 1px solid black;
- padding: 2px;
- display: inline-block;
-}
diff --git a/locpick/templates/locpick/map.html b/locpick/templates/locpick/map.html
deleted file mode 100644
index bdf4210..0000000
--- a/locpick/templates/locpick/map.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
diff --git a/locpick/templatetags/__init__.py b/locpick/templatetags/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/locpick/templatetags/gmap.py b/locpick/templatetags/gmap.py
deleted file mode 100644
index 2559453..0000000
--- a/locpick/templatetags/gmap.py
+++ /dev/null
@@ -1,28 +0,0 @@
-from django import template
-
-from locpick import settings
-
-
-register = template.Library()
-
-
-class LocpickNode(template.Node):
- def __init__(self, field, width=settings.DEFAULT_MAP_WIDTH, height=settings.DEFAULT_MAP_HEIGHT):
- self.field_name = field
- self.width = width
- self.height = height
-
- def render(self, context):
- field = template.Variable(self.field_name).resolve(context)
- return field.render_map(width=self.width, height=self.height)
-
-
-@register.tag
-def gmap(parser, token):
- bits = token.split_contents()
- if len(bits) == 2:
- return LocpickNode(field=bits[1])
- elif len(bits) == 4:
- return LocpickNode(field=bits[1], width=bits[2], height=bits[3])
- else:
- raise template.TemplateSyntaxError('{% locpick instance.location_field %} or {% locpick instance.location_field WIDTH HEIGHT %}')
diff --git a/locpick/widget.py b/locpick/widget.py
deleted file mode 100644
index b1c46c5..0000000
--- a/locpick/widget.py
+++ /dev/null
@@ -1,33 +0,0 @@
-from django import forms
-from django.conf import settings
-
-
-if hasattr(settings, 'LOCPICK_STATIC_URL'):
- STATIC_URL = settings.LOCPICK_STATIC_URL
-else:
- STATIC_URL = settings.STATIC_URL + 'locpick/'
-
-
-class LocationPickerWidget(forms.TextInput):
- class Media:
- css = {
- 'all': (
- STATIC_URL + 'location_picker.css',
- )
- }
- js = (
- 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',
- 'http://maps.google.com/maps/api/js?sensor=false',
- STATIC_URL + 'jquery.location_picker.js',
- )
-
- def __init__(self, language=None, attrs=None):
- self.language = language or settings.LANGUAGE_CODE[:2]
- super(LocationPickerWidget, self).__init__(attrs=attrs)
-
- def render(self, name, value, attrs=None):
- if None == attrs:
- attrs = {}
- attrs['class'] = 'location_picker'
- return super(LocationPickerWidget, self).render(name, value, attrs)
-
diff --git a/musicians/models.py b/musicians/models.py
index c223d58..34756e1 100644
--- a/musicians/models.py
+++ b/musicians/models.py
@@ -7,7 +7,7 @@ import os
INSTRUMENTS = (
('TR', _('Trumpet') ),
('TRB', _('Trombone') ),
- ('EUPH',_('Euphonium') ),
+ ('HRN',_('Horn') ),
('TUBA',_('Tuba') )
)
@@ -16,14 +16,20 @@ def musicianPictureName( musician, originalName ):
fileExtension = os.path.splitext(originalName)[1]
return "user_images/" + musician.user.username + fileExtension
+def musicianSmallPictureName( musician, originalName ):
+ fileExtension = os.path.splitext(originalName)[1]
+ return "user_images/" + musician.user.username + "_thumb" + fileExtension
+
class Musician( models.Model ):
# Link to user object, contains first name and last name
user = models.OneToOneField( User, verbose_name=_("user") )
- # Properties
- image = models.ImageField( upload_to = musicianPictureName, verbose_name=_("image") )
+ image = models.ImageField( upload_to = musicianPictureName, verbose_name=_("image") )
+ small_image = models.ImageField( upload_to = musicianSmallPictureName, verbose_name = _("circular thumbnail") )
+
+ # Properties
instrument = models.CharField( max_length=4, choices=INSTRUMENTS, blank=True, verbose_name=_("instrument") )
birthday = models.DateField( null=True, verbose_name=_("birthday") )
@@ -36,7 +42,13 @@ class Musician( models.Model ):
phone_mobile = models.CharField( max_length=18, blank=True, verbose_name=_("phone_mobile") )
phone_work = models.CharField( max_length=18, blank=True, verbose_name=_("phone_work") )
+ @property
+ def isDeepBrass(self):
+ return self.instrument == 'TRB' or self.instrument == "EUPH" or self.instrument == "TUBA" or self.instrument == "HRN"
+ @property
+ def isHighBrass(self):
+ return self.instrument == 'TR'
public_description = models.TextField( blank=True, verbose_name=_("public_description") )
diff --git a/musicians/templates/musicians/addressbook.html b/musicians/templates/musicians/addressbook.html
new file mode 100644
index 0000000..13868d5
--- /dev/null
+++ b/musicians/templates/musicians/addressbook.html
@@ -0,0 +1,144 @@
+{% extends "website/base.html" %}
+
+
+{% load sekizai_tags staticfiles %}
+
+
+{% block feature_slider %}
+{% endblock %}
+
+
+{% block navbar_options %} navbar navbar-inverse navbar-static-top {% endblock %}
+
+
+{% block content %}
+
+
+{% addtoblock "css" strip %}
{% endaddtoblock %}
+
+{% addtoblock "css" %}
+
+{% endaddtoblock %}
+
+
+{% addtoblock "js" strip %} {% endaddtoblock %}
+
+
+{% addtoblock "js" %}
+
+
+{% endaddtoblock %}
+
+
+
+
+
+
+
+
+
+
+
+
+ {% for m in musicians %}
+
+
+
+
+
+
+
+ {{ m.user.first_name }} {{m.user.last_name }}
+
+
+
+ {% if m.street %} Adresse {{m.street}}
+ {{m.zip_code}} {{m.city}} {% endif %}
+ {% if m.birthday %} Geburtstag: {{m.birthday }} {% endif %}
+ {% if m.phone_home %} Telefon (Home): {{m.phone_home }} {% endif %}
+ {% if m.phone_mobile %} Telefon (Mobil): {{m.phone_mobile }} {% endif %}
+ {% if m.phone_work %} Telefon (Arbeit): {{m.phone_work }} {% endif %}
+
+
+ {% endfor %}
+
+
+
+
+
+
+
+
+{% endblock %}
+
diff --git a/musicians/views.py b/musicians/views.py
index e8c326d..911b1c9 100644
--- a/musicians/views.py
+++ b/musicians/views.py
@@ -12,7 +12,7 @@ class MusicianList( ListView):
model = Musician
-class UserEditForm(forms.ModelForm):
+class UserEditForm( forms.ModelForm ):
email = forms.EmailField()
@@ -43,7 +43,6 @@ class UserEditForm(forms.ModelForm):
model = Musician
exclude = [ 'user','image', 'instrument' ]
#fields = '__all__'
-
def user_edit( request, username ):
@@ -66,4 +65,20 @@ class MusicianUpdate( UpdateView ):
model = Musician
#fields = []
template_name = "musicians/musician_edit.html"
- success_url = '/books/'
\ No newline at end of file
+ success_url = '/books/'
+
+
+def addressbook( request ):
+ context = dict()
+ context['musicians'] = Musician.objects.all()
+
+ return render( request, 'musicians/addressbook.html', context )
+
+
+
+
+
+
+
+
+
diff --git a/website/templates/website/base.html b/website/templates/website/base.html
index 3f93b0b..be81312 100644
--- a/website/templates/website/base.html
+++ b/website/templates/website/base.html
@@ -28,6 +28,7 @@
{% addtoblock "js" strip %} {% endaddtoblock %}
{% addtoblock "js" strip %} {% endaddtoblock %}
{% addtoblock "js" strip %} {% endaddtoblock %}
+{% addtoblock "js" strip %} {% endaddtoblock %}
{% addtoblock "js" %}
diff --git a/website/templates/website/mainpage.html b/website/templates/website/mainpage.html
index 7a6de18..533da2b 100644
--- a/website/templates/website/mainpage.html
+++ b/website/templates/website/mainpage.html
@@ -75,87 +75,89 @@
{% addtoblock "css" strip %}
{% endaddtoblock %}
{% addtoblock "css" strip %}
{% endaddtoblock %}
+ {% if event %}
+
+ {% addtoblock "js" %}
+
+ {% endaddtoblock %}
+
+
+
+
+
+
+
+
Der nächste Termin:
+
+ {{event.title}} ist am {{event.date}} um {{event.displaytime | time:"H:i" }} in {{event.location}}
+
+
+ {% if participation == "?" %}
+ Du hast dich noch nicht für diesen Termin eingetragen!
+ {% elif participation == "Yes" %}
+ Du hast für diesen Termin zugesagt.
+ {% elif participation == "No" %}
+ Du hast für diesen Termin abgesagt.
+ {%endif %}
+
+
+
+
+
+
+ {% endif %}
- {% addtoblock "js" %}
-
- {% endaddtoblock %}
-
-
-
-
-
-
-
-
Der nächste Termin:
-
- {{event.title}} ist am {{event.date}} um {{event.displaytime | time:"H:i" }} in {{event.location}}
-
-
- {% if participation == "?" %}
- Du hast dich noch nicht für diesen Termin eingetragen!
- {% elif participation == "Yes" %}
- Du hast für diesen Termin zugesagt.
- {% elif participation == "No" %}
- Du hast für diesen Termin abgesagt.
- {%endif %}
-
-
-
-
-
-
-
{% endblock %}
diff --git a/website/views.py b/website/views.py
index 21dfc57..308ee6d 100644
--- a/website/views.py
+++ b/website/views.py
@@ -7,26 +7,35 @@ from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.utils import simplejson
+from django.contrib.auth.decorators import login_required
from eventplanner.models import Event, EventParticipation
from datetime import datetime
+@login_required
def home_view(request):
- events = Event.objects.filter( date__gte = datetime.now() ).order_by('date')[:1]
context = dict()
-
-
- part = EventParticipation.objects.filter( musician__user = request.user ).filter( event = events[0] )
-
- eventTime = datetime( events[0].date.year, events[0].date.month, events[0].date.day,
- events[0].displaytime.hour, events[0].displaytime.minute )
-
- context['hasParticipationSetForAllEvents'] = EventParticipation.hasUserSetParticipationForAllEvents( request.user)
- context['event'] = events[0]
- context['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 )
- context['participation'] = part[0].status
+
+ events = Event.objects.filter( date__gte = datetime.now() ).order_by('date')[:1]
+ if ( len(events) > 0 ):
+ print "len(events): " + str( len(events ))
+ nextEvent = events[0]
+ part = EventParticipation.objects.filter( musician__user = request.user ).filter( event = nextEvent )
+
+ eventTime = datetime( events[0].date.year, events[0].date.month, events[0].date.day,
+ events[0].displaytime.hour, events[0].displaytime.minute )
+
+ context['hasParticipationSetForAllEvents'] = EventParticipation.hasUserSetParticipationForAllEvents( request.user)
+ context['event'] = events[0]
+
+ context['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 )
+ context['participation'] = part[0].status
+ else:
+ context['hasParticipationSetForAllEvents'] = True
+
+
return render( request, 'website/mainpage.html', context )
@@ -48,7 +57,8 @@ def login_view(request):
if not request.POST.get('remember', None):
request.session.set_expiry( 0 )
login(request, user)
- result['redirect'] = reverse( home_view )
+ #result['redirect'] = reverse( home_view )
+ result['redirect'] = "/"
else:
result['err'] = "Dein Account wurde deaktiviert."
# Return a 'disabled account' error message