Skip to content

Commit

Permalink
убрал лишнее определение CustomPagination in Views
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-xx committed Nov 14, 2023
1 parent 2babaaf commit c513789
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
6 changes: 0 additions & 6 deletions backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from rest_framework.response import Response
from rest_framework.views import APIView

from core.pagination import CustomPagination
from recipes.models import (Favorite, Follow, Ingredient, Recipe, ShoppingCart,
Tag)
from .filters import IngredientFilter, RecipeFilter
Expand All @@ -33,7 +32,6 @@ class UsersViewSet(mixins.UpdateModelMixin,
serializer_class = UserSerializer
permission_classes = (AllowAny, )
http_method_names = ['get', 'post']
pagination_class = CustomPagination


class UserMe(APIView):
Expand Down Expand Up @@ -72,7 +70,6 @@ class RecipeViewSet(viewsets.ModelViewSet):
serializer_class = RecipeSerializer
permission_classes = (IsAuthenticatedOrReadOnly,
IsOwnerOrReadOnly)
pagination_class = CustomPagination
filter_backends = (DjangoFilterBackend,)
filterset_class = RecipeFilter

Expand Down Expand Up @@ -128,7 +125,6 @@ class FavoriteViewSet(BaseViewset):
permission_classes = (IsAuthenticated,)
http_method_names = ['post', 'delete']
lookup_field = 'id'
pagination_class = CustomPagination


class ShoppingCartViewSet(BaseViewset):
Expand All @@ -138,7 +134,6 @@ class ShoppingCartViewSet(BaseViewset):
serializer_class = ShoppingCartSerializer
permission_classes = (IsAuthenticated,)
http_method_names = ['post', 'delete']
pagination_class = CustomPagination
model = ShoppingCart
title_model = Recipe

Expand Down Expand Up @@ -177,7 +172,6 @@ class FollowListViewSet(mixins.ListModelMixin,

serializer_class = FollowSerializer
permission_classes = (IsAuthenticated,)
pagination_class = CustomPagination

def get_queryset(self):
return (
Expand Down
26 changes: 13 additions & 13 deletions backend/foodgram/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,24 @@
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': BASE_DIR / 'db.sqlite3',
# }
# }

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('POSTGRES_DB', 'django'),
'USER': os.getenv('POSTGRES_USER', 'django'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD', ''),
'HOST': os.getenv('DB_HOST', ''),
'PORT': os.getenv('DB_PORT'),
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}

# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.postgresql',
# 'NAME': os.getenv('POSTGRES_DB', 'django'),
# 'USER': os.getenv('POSTGRES_USER', 'django'),
# 'PASSWORD': os.getenv('POSTGRES_PASSWORD', ''),
# 'HOST': os.getenv('DB_HOST', ''),
# 'PORT': os.getenv('DB_PORT'),
# }
# }

# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators

Expand Down

0 comments on commit c513789

Please sign in to comment.