diff --git a/apps/establishment/urls/common.py b/apps/establishment/urls/common.py index 12745c51..a73a3f3e 100644 --- a/apps/establishment/urls/common.py +++ b/apps/establishment/urls/common.py @@ -13,6 +13,5 @@ urlpatterns = [ name='create-comment'), path('/comment//', views.EstablishmentCommentRUDView.as_view(), name='rud-comment'), - path('/favorites/add/', views.EstablishmentFavoritesCreateView.as_view()), - path('/favorites/delete/', views.EstablishmentFavoritesDestroyView.as_view()), + path('/favorites/', views.EstablishmentFavoritesCreateDestroyView.as_view()), ] \ No newline at end of file diff --git a/apps/establishment/views.py b/apps/establishment/views.py index 6324f17c..077f8502 100644 --- a/apps/establishment/views.py +++ b/apps/establishment/views.py @@ -79,14 +79,10 @@ class EstablishmentCommentRUDView(generics.RetrieveUpdateDestroyAPIView): return comment_obj -class EstablishmentFavoritesCreateView(generics.CreateAPIView): - """View for adding establishment to favorites.""" +class EstablishmentFavoritesCreateDestroyView(generics.CreateAPIView, generics.DestroyAPIView): + """View for create/destroy establishment from favorites.""" serializer_class = serializers.EstablishmentFavoritesCreateSerializer - -class EstablishmentFavoritesDestroyView(generics.DestroyAPIView): - """View for destroy establishment from favorites.""" - def get_object(self): """ Returns the object the view is displaying.