Commit 88a40a90 authored by luxcem's avatar luxcem

Change vote to use django-und

parent 2a9a9a99
...@@ -30,11 +30,11 @@ class ArticleViewSet(viewsets.ModelViewSet): ...@@ -30,11 +30,11 @@ class ArticleViewSet(viewsets.ModelViewSet):
@detail_route(methods=["post"], url_path="upvote") @detail_route(methods=["post"], url_path="upvote")
def upvote(self, request, pk=None): def upvote(self, request, pk=None):
article = self.get_object() article = self.get_object()
article.upvote(request.user) article.upvote(user_object=request.user.username)
return self.response_serialized_object(article) return self.response_serialized_object(article)
@detail_route(methods=["post"], url_path="downvote") @detail_route(methods=["post"], url_path="downvote")
def downvote(self, request, pk=None): def downvote(self, request, pk=None):
article = self.get_object() article = self.get_object()
article.downvote(request.user) article.downvote(user_object=request.user.username)
return self.response_serialized_object(article) return self.response_serialized_object(article)
...@@ -35,3 +35,6 @@ PROJECT_APPS = [ ...@@ -35,3 +35,6 @@ PROJECT_APPS = [
] ]
INSTALLED_APPS = DJANGO_APPS + CONTRIB_APPS + PROJECT_APPS INSTALLED_APPS = DJANGO_APPS + CONTRIB_APPS + PROJECT_APPS
# Use username for upvote instead of user object
UND_USE_USERNAME = True
...@@ -15,5 +15,5 @@ router.extend(rp_router) ...@@ -15,5 +15,5 @@ router.extend(rp_router)
urlpatterns = [ urlpatterns = [
url(r"^admin/", admin.site.urls), url(r"^admin/", admin.site.urls),
url(r"^api/", include(router.urls, namespace="api")), url(r"^api/", include(router.urls, namespace="api")),
url(r"^rp/", include("rp.urls")) url(r"^rp/", include("rp.urls", namespace="rp"))
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment