Skip to content

Commit

Permalink
Merge pull request #5225 from onepercentclub/hotfix/impact-type-api
Browse files Browse the repository at this point in the history
add Impact Type Detail endpoint for stats
  • Loading branch information
gannetson committed Sep 5, 2022
2 parents b5cf958 + 5fcd4f9 commit 1a9d4dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion bluebottle/impact/urls/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
from bluebottle.impact.views import (
ImpactTypeList,
ImpactGoalList,
ImpactGoalDetail
ImpactGoalDetail, ImpactTypeDetail
)

urlpatterns = [
url(r'^types$', ImpactTypeList.as_view(), name='impact-type-list'),
url(
r'^types/(?P<pk>\d+)$',
ImpactTypeDetail.as_view(),
name='impact-details'
),
url(r'^goals$', ImpactGoalList.as_view(), name='impact-goal-list'),
url(
r'^goals/(?P<pk>\d+)$',
Expand Down
11 changes: 10 additions & 1 deletion bluebottle/impact/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
JsonApiViewMixin,
ListAPIView,
CreateAPIView,
RetrieveUpdateDestroyAPIView
RetrieveUpdateDestroyAPIView, RetrieveAPIView
)
from bluebottle.utils.permissions import TenantConditionalOpenClose

Expand All @@ -33,6 +33,15 @@ class ImpactTypeList(JsonApiViewMixin, ListAPIView):
filter_backends = (ImpactTypeSearchFilter, )


class ImpactTypeDetail(JsonApiViewMixin, RetrieveAPIView):
queryset = ImpactType.objects.filter(active=True)

permission_classes = [TenantConditionalOpenClose, ]
serializer_class = ImpactTypeSerializer
pagination_class = ImpactTypePagination
filter_backends = (ImpactTypeSearchFilter, )


class ImpactGoalList(JsonApiViewMixin, CreateAPIView):
queryset = ImpactGoal.objects.filter()

Expand Down

0 comments on commit 1a9d4dd

Please sign in to comment.