tag added to API
This commit is contained in:
parent
36f038259b
commit
cd1ed08ca6
3 changed files with 6 additions and 8 deletions
|
@ -48,12 +48,14 @@ class PlaceSerializer(EventSpecificSerializer):
|
||||||
fields = ('url', 'id', 'name', 'description', 'event')
|
fields = ('url', 'id', 'name', 'description', 'event')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO rajouter des permissions
|
# TODO rajouter des permissions
|
||||||
class ActivityTagSerializer(serializers.HyperlinkedModelSerializer):
|
class ActivityTagSerializer(EventSpecificSerializer):
|
||||||
|
event = EventSerializer(allow_null=True, read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ActivityTag
|
model = ActivityTag
|
||||||
fields = ('url', 'id', 'name', 'is_public', 'color',)
|
fields = ('url', 'id', 'name', 'is_public', 'color', 'event')
|
||||||
|
|
||||||
|
|
||||||
# TODO rajouter des permissions
|
# TODO rajouter des permissions
|
||||||
|
|
|
@ -56,12 +56,7 @@ class PlaceViewSet(EventSpecificViewSet):
|
||||||
serializer_class = PlaceSerializer
|
serializer_class = PlaceSerializer
|
||||||
|
|
||||||
|
|
||||||
class ActivityTagViewSet(ModelViewSet):
|
class ActivityTagViewSet(EventSpecificViewSet):
|
||||||
"""
|
|
||||||
This viewset automatically provides `list`, `create`, `retrieve`,
|
|
||||||
`update` and `destroy` actions.
|
|
||||||
|
|
||||||
"""
|
|
||||||
queryset = ActivityTag.objects.all()
|
queryset = ActivityTag.objects.all()
|
||||||
serializer_class = ActivityTagSerializer
|
serializer_class = ActivityTagSerializer
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ router.register(r'activitytemplate', ActivityTemplateViewSet)
|
||||||
# Register nested router and register someviewsets vith it
|
# Register nested router and register someviewsets vith it
|
||||||
event_router = NestedSimpleRouter(router, r'event', lookup='event')
|
event_router = NestedSimpleRouter(router, r'event', lookup='event')
|
||||||
event_router.register(r'place', PlaceViewSet, base_name='event-names')
|
event_router.register(r'place', PlaceViewSet, base_name='event-names')
|
||||||
|
event_router.register(r'tag', ActivityTagViewSet, base_name='event-names')
|
||||||
|
|
||||||
|
|
||||||
# The API URLs are now determined automatically by the router.
|
# The API URLs are now determined automatically by the router.
|
||||||
|
|
Loading…
Reference in a new issue