diff --git a/blechreiz/database.sqlite b/blechreiz/database.sqlite index 038adcf..2e76fde 100644 Binary files a/blechreiz/database.sqlite and b/blechreiz/database.sqlite differ diff --git a/blechreiz/settings.py b/blechreiz/settings.py index 85e8960..fb2850a 100644 --- a/blechreiz/settings.py +++ b/blechreiz/settings.py @@ -148,8 +148,16 @@ INSTALLED_APPS = ( 'sekizai', 'intern_area', 'website', + 'rest_framework', ) + +REST_FRAMEWORK = { + 'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',), + 'PAGINATE_BY': 10 +} + + CRISPY_TEMPLATE_PACK = 'bootstrap' # A sample logging configuration. The only tangible logging diff --git a/blechreiz/urls.py b/blechreiz/urls.py index 868037d..52309cb 100644 --- a/blechreiz/urls.py +++ b/blechreiz/urls.py @@ -9,6 +9,10 @@ import intern_area.views import website.views +import eventplanner.views + + + admin.autodiscover() urlpatterns = patterns('', @@ -28,4 +32,8 @@ urlpatterns = patterns('', url(r'^website/$', website.views.home_view), url(r'^login/$', website.views.login_view), url(r'^logout/$', website.views.logout_view), + url(r'^events/$', eventplanner.views.events_view), + url(r'^eventParticipation/$', eventplanner.views.event_participation_list ), + url(r'^eventParticipation/(\w+)/$', eventplanner.views.event_participation_detail ), + url(r'^eventParticipation/(\w+)/(\d+)$', eventplanner.views.event_participation_detail ), ) \ No newline at end of file diff --git a/eventplanner/models.py b/eventplanner/models.py index abc0d25..4b3ced8 100644 --- a/eventplanner/models.py +++ b/eventplanner/models.py @@ -51,5 +51,10 @@ class EventParticipation( models.Model ): status = models.CharField ( max_length=3, choices = OPTIONS, default='?' ) comment = models.CharField ( max_length=64, blank=True ) + def get_musician_username(self): + return self.musician.user.username + class Meta: - unique_together = ("event", "musician") \ No newline at end of file + unique_together = ("event", "musician") + + \ No newline at end of file diff --git a/eventplanner/serializers.py b/eventplanner/serializers.py new file mode 100644 index 0000000..e0dc106 --- /dev/null +++ b/eventplanner/serializers.py @@ -0,0 +1,24 @@ +from rest_framework import serializers +from models import EventParticipation + + + + +class ParticipationSerializer(serializers.ModelSerializer): + event = serializers.PrimaryKeyRelatedField( many=False, read_only = False ) + musician = serializers.Field( source='get_musician_username' ) +# musician = serializers.PrimaryKeyRelatedField( many=False, read_only = False ) + + def get_identity(self, data): + """ This hook is required for bulk update. """ + try: + return ( data.get('event', None), data.get('musician') ) + except AttributeError: + return None + + class Meta: + model = EventParticipation + fields = ('event', 'musician', 'status', 'comment') + + + diff --git a/eventplanner/templates/eventplanner/event_view.html b/eventplanner/templates/eventplanner/event_view.html new file mode 100644 index 0000000..86897c0 --- /dev/null +++ b/eventplanner/templates/eventplanner/event_view.html @@ -0,0 +1,175 @@ +{% 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 "js" %} + + + {% endaddtoblock %} + + +
Termin | +Datum | +Uhrzeit | +Ort | +Status ändern | +Kommentar | +
---|---|---|---|---|---|
{{ event.title }} | +{{ event.date }} | +{{ event.time }} | + +Ort | + +
+
+
+
+
+
+ |
+
+
+
+
+
+ |
+