diff --git a/blechreiz/database.sqlite b/blechreiz/database.sqlite index 2b79c92..a79646f 100644 Binary files a/blechreiz/database.sqlite and b/blechreiz/database.sqlite differ diff --git a/blechreiz/media/user_images/MartinB_1.png b/blechreiz/media/user_images/MartinB_1.png deleted file mode 100644 index 63220e4..0000000 Binary files a/blechreiz/media/user_images/MartinB_1.png and /dev/null differ diff --git a/blechreiz/media/user_images/Rebecca_1.png b/blechreiz/media/user_images/Rebecca_1.png deleted file mode 100644 index fdfd5e1..0000000 Binary files a/blechreiz/media/user_images/Rebecca_1.png and /dev/null differ diff --git a/blechreiz/media/user_images/martin.png b/blechreiz/media/user_images/martin.png deleted file mode 100644 index 63220e4..0000000 Binary files a/blechreiz/media/user_images/martin.png and /dev/null differ diff --git a/blechreiz/media/user_images/martin_1.png b/blechreiz/media/user_images/martin_1.png deleted file mode 100644 index 63220e4..0000000 Binary files a/blechreiz/media/user_images/martin_1.png and /dev/null differ diff --git a/blechreiz/media/user_images/martin_circle.png b/blechreiz/media/user_images/martin_circle.png deleted file mode 100644 index a1183fc..0000000 Binary files a/blechreiz/media/user_images/martin_circle.png and /dev/null differ diff --git a/blechreiz/media/user_images/martin_thumb.png b/blechreiz/media/user_images/martin_thumb.png deleted file mode 100644 index a1183fc..0000000 Binary files a/blechreiz/media/user_images/martin_thumb.png and /dev/null differ diff --git a/blechreiz/media/user_images/rebecca.png b/blechreiz/media/user_images/rebecca.png deleted file mode 100644 index fdfd5e1..0000000 Binary files a/blechreiz/media/user_images/rebecca.png and /dev/null differ diff --git a/blechreiz/media/user_images/rebecca_1.png b/blechreiz/media/user_images/rebecca_1.png deleted file mode 100644 index 94e815a..0000000 Binary files a/blechreiz/media/user_images/rebecca_1.png and /dev/null differ diff --git a/blechreiz/media/user_images/rebecca_circle.png b/blechreiz/media/user_images/rebecca_circle.png deleted file mode 100644 index 5601bad..0000000 Binary files a/blechreiz/media/user_images/rebecca_circle.png and /dev/null differ diff --git a/blechreiz/media/user_images/rebecca_vildosola.png b/blechreiz/media/user_images/rebecca_vildosola.png deleted file mode 100644 index fdfd5e1..0000000 Binary files a/blechreiz/media/user_images/rebecca_vildosola.png and /dev/null differ diff --git a/blechreiz/media/user_images/rebecca_vildosola_thumb.png b/blechreiz/media/user_images/rebecca_vildosola_thumb.png deleted file mode 100644 index 5601bad..0000000 Binary files a/blechreiz/media/user_images/rebecca_vildosola_thumb.png and /dev/null differ diff --git a/eventplanner/models.py b/eventplanner/models.py index d57a4e0..5c8b783 100644 --- a/eventplanner/models.py +++ b/eventplanner/models.py @@ -1,8 +1,9 @@ from django.db import models from django.utils.translation import ugettext as _ -from django.contrib.auth.models import User +from django.contrib.auth.models import User, Permission +from django.db.models import Q from datetime import datetime from location_field.models import PlainLocationField @@ -78,6 +79,9 @@ class EventParticipation( models.Model ): @staticmethod def hasUserSetParticipationForAllEvents( user ): + if not EventParticipation.isMember(user): + return True + futurePart = EventParticipation.objects.filter( event__date__gte = datetime.now() ) maybeObjects = futurePart.filter( user = user ).filter( status = '?' ) @@ -86,6 +90,18 @@ class EventParticipation( models.Model ): else: return True + @staticmethod + def isMember( user ): + return user.has_perm('eventplanner.member') + + @staticmethod + def isAdmin( user ): + return user.has_perm('eventplanner.admin') + + @staticmethod + def members(): + perm = Permission.objects.get( codename='member' ) + return User.objects.filter(Q(groups__permissions=perm) | Q(user_permissions=perm) ).distinct() @staticmethod def get_or_create( user , event ): @@ -99,8 +115,9 @@ class EventParticipation( models.Model ): class Meta: unique_together = ("event", "user") permissions = ( - ("change_others_participation", _("Can modify participation status of other users") ), + ("admin", _("Admin") ), + ("member", _("Member") ), ) - + \ No newline at end of file diff --git a/eventplanner/serializers.py b/eventplanner/serializers.py index 5daf0f0..f7cd4b0 100644 --- a/eventplanner/serializers.py +++ b/eventplanner/serializers.py @@ -7,10 +7,12 @@ from models import EventParticipation class ParticipationSerializer(serializers.ModelSerializer): event = serializers.PrimaryKeyRelatedField( many=False, read_only = False ) user = serializers.Field( source='get_username' ) + status = serializers.CharField( source='status', required=False ) def get_identity(self, data): - """ This hook is required for bulk update. """ + """ This hook is required for bulk update. """ try: + print "get_identity event:" + str( data.get('event', None) ) + " user " + str( data.get('user') ) return ( data.get('event', None), data.get('user') ) except AttributeError: return None diff --git a/eventplanner/templates/eventplanner/eventplanning_view.html b/eventplanner/templates/eventplanner/eventplanning_view.html index 4a6a696..ee17e42 100644 --- a/eventplanner/templates/eventplanner/eventplanning_view.html +++ b/eventplanner/templates/eventplanner/eventplanning_view.html @@ -41,38 +41,36 @@ } } - function putStatus( button, status ) { + function putStatus( button, status ) + { $("#saving").html("Speichere.."); p = button.parent(); putObject = [ { "event": p.data("event-id"), "user": p.data("username"), "status": status } ]; - + request = $.ajax( { type: "PUT", url: "{% url 'event_api' %}", contentType: "application/json", data: JSON.stringify(putObject), - success: function() { $("#saving").html("Ok"); } + success: function() { $("#saving").html("Ok"); }, + error: function(jqXHR, text, errorText) { console.log("Ajax failed " + errorText + JSON.stringify(putObject) ); } }); setEventButtonStatus( button, status ); - //request.done(function(jqXHR, textStatus) { - // setEventButtonStatus( button, status ) - //}); } $(function(){ $(".event-comment").bindWithDelay("keypress", function() { - $("#saving").html("Speichere.."); putObject = [ { "event": $(this).data("event-id"), "user": $(this).data("username"), "comment": $(this).val() } ]; - + $.ajax( { type: "PUT", url: "{% url 'event_api' %}", @@ -103,13 +101,17 @@
-
+

Termine

- + + +

zur Übersicht

+ +
@@ -140,7 +142,7 @@
{{ event.location }} -
+
@@ -172,8 +174,9 @@
Änderungen werden automatisch gespeichert: Ok
-
- +
+ +

diff --git a/eventplanner/templates/eventplanner/events_grid.html b/eventplanner/templates/eventplanner/events_grid.html index 1629652..3199d91 100644 --- a/eventplanner/templates/eventplanner/events_grid.html +++ b/eventplanner/templates/eventplanner/events_grid.html @@ -16,9 +16,14 @@ {% block content %} {% addtoblock "css" %} {% endaddtoblock %} @@ -101,7 +105,7 @@
  • /
  • Unterstimmen
  • /
  • -
  • Oberstimmen
  • +
  • Oberstimmen
  • /
  • Rest
  • @@ -124,12 +128,12 @@ - {% if m.street %} - {% endif %} - {% if m.birthday %} {% endif %} - {% if m.phone_home %} {% endif %} - {% if m.phone_mobile %}{% endif %} - {% if m.phone_work %} {% endif %} + {% if m.street %} + {% endif %} + {% if m.birthday %} {% endif %} + {% if m.phone_home %} {% endif %} + {% if m.phone_mobile %}{% endif %} + {% if m.phone_work %} {% endif %}
    Adresse {{m.street}}
    {{m.zip_code}} {{m.city}}
    Geburtstag: {{m.birthday }}
    Telefon (Home): {{m.phone_home }}
    Telefon (Mobil): {{m.phone_mobile }}
    Telefon (Arbeit): {{m.phone_work }}
    Adresse {{m.street}}
    {{m.zip_code}} {{m.city}}
    Geburtstag: {{m.birthday }}
    Telefon (Home): {{m.phone_home }}
    Telefon (Mobil): {{m.phone_mobile }}
    Telefon (Arbeit): {{m.phone_work }}
    {% endfor %} diff --git a/website/static/css/sign-in.css b/website/static/css/sign-in.css index 10956bc..e207fbc 100644 --- a/website/static/css/sign-in.css +++ b/website/static/css/sign-in.css @@ -30,43 +30,6 @@ font-size: 17px; margin: 0 0 40px 0; } -#sign_in .header .social{ - margin: 0 auto 28px; - float: none; - text-align: center; -} -#sign_in .header .social a.circle{ - text-align: center; - width: 56px; - height: 56px; - border-radius: 100%; - margin-right: 25px; - display: inline-block; - -webkit-transition: border-color ease-in .1s; - -moz-transition: border-color ease-in .1s; - -o-transition: border-color ease-in .1s; - transition: border-color ease-in .1s; -} -#sign_in .header .social a.circle img{ - display: inline-block; - margin-top: 15px; -} -#sign_in .header .social a.facebook{ - border:2px solid #233678; - background: #233678; -} -#sign_in .header .social a.twitter{ - border:2px solid #54AEE1; - background: #54AEE1; -} -#sign_in .header .social a.gplus{ - border:2px solid #292929; - background: #292929; - margin: 0; -} -#sign_in .header .social a.circle:hover{ - border-color: rgb(255, 255, 255); -} #sign_in .division{ margin: 0 auto 50px; float: none; diff --git a/website/templates/website/event_countdown.html b/website/templates/website/event_countdown.html index 13aa2e8..9514328 100644 --- a/website/templates/website/event_countdown.html +++ b/website/templates/website/event_countdown.html @@ -43,13 +43,15 @@ in {{countdown.event.location}}
    - {% if countdown.participation == "?" %} - Du hast dich noch nicht für diesen Termin eingetragen! - {% elif countdown.participation == "Yes" %} - Du hast für diesen Termin zugesagt. - {% elif countdown.participation == "No" %} - Du hast für diesen Termin abgesagt. - {%endif %} + {% if 'participation' in countdown %} + {% if countdown.participation == "?" %} + Du hast dich noch nicht für diesen Termin eingetragen! + {% elif countdown.participation == "Yes" %} + Du hast für diesen Termin zugesagt. + {% elif countdown.participation == "No" %} + Du hast für diesen Termin abgesagt. + {%endif %} + {% endif %}

    diff --git a/website/templates/website/slider_intern_area.html b/website/templates/website/slider_intern_area.html index 787d558..35d8181 100644 --- a/website/templates/website/slider_intern_area.html +++ b/website/templates/website/slider_intern_area.html @@ -90,7 +90,7 @@ diff --git a/website/views.py b/website/views.py index 9cf827b..7e3419b 100644 --- a/website/views.py +++ b/website/views.py @@ -21,24 +21,25 @@ from django.contrib.auth.models import User def home_view(request): context = dict() - # Event participation for slider text - context['hasParticipationSetForAllEvents'] = EventParticipation.hasUserSetParticipationForAllEvents( request.user) - + if EventParticipation.isMember( request.user ): + context['hasParticipationSetForAllEvents'] = EventParticipation.hasUserSetParticipationForAllEvents( request.user) # Countdown countdown = dict() events = Event.objects.filter( date__gte = datetime.now() ).order_by('date')[:1] if ( len(events) > 0 ): nextEvent = events[0] - part = EventParticipation.objects.filter( user = request.user ).filter( event = nextEvent ) + + if EventParticipation.isMember( request.user ): + part = EventParticipation.objects.filter( user = request.user ).filter( event = nextEvent ) + countdown['participation'] = part[0].status eventTime = datetime( events[0].date.year, events[0].date.month, events[0].date.day, events[0].displaytime.hour, events[0].displaytime.minute ) countdown['event'] = events[0] countdown['epoch'] = int( (eventTime - datetime.now() ).total_seconds() * 1000 ) - countdown['participation'] = part[0].status context['countdown'] = countdown @@ -128,5 +129,5 @@ from django.core.urlresolvers import reverse def change_password( request ): template_name = "website/change_password.html" - return django.contrib.auth.views.password_change(request, template_name, post_change_redirect= reverse(home_view) ) + return django.contrib.auth.views.password_change(request, template_name, post_change_redirect= "/" )