Skip to content

Commit

Permalink
Merge pull request #78 from fabricadesoftware-ifc/Feat-76
Browse files Browse the repository at this point in the history
Feat: Autentificação de Usuário #76
  • Loading branch information
ldmfabio authored Aug 29, 2023
2 parents 77f39ad + cea629c commit 6cf8714
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 25 deletions.
34 changes: 20 additions & 14 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,16 @@
# SECURITY WARNING: don't run with debug turned on in production!
# DEBUG = True

# ALLOWED_HOSTS = []
ALLOWED_HOSTS = []

env = environ.Env()
environ.Env.read_env((os.path.join(BASE_DIR, ".env")))

SECRET_KEY = env("SECRET_KEY")
DEBUG = env("DEBUG")
ALLOWED_HOSTS = []
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BASE_DIR / "db.sqlite3",
}
}

ALLOWED_HOSTS = env("ALLOWED_HOSTS").split(",")
DATABASES = {"default": env.db()}


# Application definition
Expand Down Expand Up @@ -106,18 +102,28 @@
},
]

REST_FRAMEWORK = {
"DEFAULT_PERMISSION_CLASSES": [
"rest_framework.permissions.IsAuthenticated",
"rest_framework_simplejwt.authentication.JWTAuthentication",
],
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework_simplejwt.authentication.JWTAuthentication",
],
}

WSGI_APPLICATION = "config.wsgi.application"


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

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


# Password validation
Expand Down
2 changes: 0 additions & 2 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path

from uploader.router import router as uploader_router

from .routers import router

urlpatterns = [
Expand Down
2 changes: 1 addition & 1 deletion core/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from .comments import Comments
from .favorites import Favorites
from .feeling import Feeling
from .help import Help
from .news import News
from .newsFeel import NewsFeel
from .reaction import Reaction
from .saveToRead import SaveToRead
from .help import Help
8 changes: 4 additions & 4 deletions core/serializers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .comments import CommentsSerializer
from .reaction import ReactionSerializer
from .saveToRead import SaveToReadSerializer
from .categories import CategorySerializer
from .comments import CommentsSerializer
from .favorite import FavoritesSerializer
from .feeling import FeelingSerializer
from .help import HelpSerializer
from .news import NewsSerializer
from .newsFeel import NewsFeelSerializer
from .help import HelpSerializer
from .reaction import ReactionSerializer
from .saveToRead import SaveToReadSerializer
1 change: 0 additions & 1 deletion core/serializers/news.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from rest_framework.serializers import ModelSerializer, SlugRelatedField

from core.models import News
from uploader.models import Image
from uploader.serializers import ImageSerializer
Expand Down
4 changes: 2 additions & 2 deletions core/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .comments import CommentsViewSet
from .categories import CategoryViewSet
from .comments import CommentsViewSet
from .favorite import FavoritesViewSet
from .feeling import FeelingViewSet
from .help import HelpViewSet
from .news import NewsViewSet
from .newsFeel import NewsFeelViewSet
from .reaction import ReactionViewSet
from .saveToRead import SaveToReadViewSet
from .help import HelpViewSet
36 changes: 36 additions & 0 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ dependencies = [
"djangorestframework>=3.14.0",
"django-environ>=0.10.0",
"django-cors-headers>=4.2.0",
"djangorestframework-simplejwt>=5.3.0",
"setuptools>=68.1.2",
"python-magic>=0.4.27",
"pillow>=10.0.0",
"dotenv>=0.0.5",
"python-dotenv>=1.0.0",
]
requires-python = ">=3.10"
requires-python = ">=3.8"
license = { text = "MIT" }

[tool.black]
Expand Down
2 changes: 2 additions & 0 deletions user/views/userProjectFollow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from rest_framework.permissions import IsAuthenticated
from rest_framework.viewsets import ModelViewSet

from user.models import UserProjectFollow
Expand All @@ -7,3 +8,4 @@
class UserProjectFollowViewSet(ModelViewSet):
queryset = UserProjectFollow.objects.all() # pylint: disable=E1101
serializer_class = UserProjectFollowSerializer
permission_classes = [IsAuthenticated]

0 comments on commit 6cf8714

Please sign in to comment.