Skip to content

Commit a020808

Browse files
committed
lint code dev
1 parent 289d559 commit a020808

File tree

9 files changed

+23
-30
lines changed

9 files changed

+23
-30
lines changed

apps/blog/tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from datetime import datetime
22

33
from django.test import TestCase
4-
from django.core.files.uploadedfile import UploadedFile
54

65
from apps.users.models import User
76
from apps.blog.models import Post
87
from django.urls import reverse
9-
from .forms import PostCreateUpdateForm, SettingsUserForm, SettingsUserProfileForm
8+
from .forms import PostCreateUpdateForm, SettingsUserForm
109
from .choices import StatusChoice
1110

1211

apps/blog/views.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import datetime
2-
from functools import wraps
3-
from typing import Any
42

53
from django.shortcuts import render, redirect, get_object_or_404
64
from django.contrib.auth.mixins import LoginRequiredMixin
75
from django.views.generic import TemplateView, DeleteView
86
from django.contrib import messages
9-
from django.http import HttpRequest
107
from django.views import View
118
from django.urls import reverse
129

1310
from apps.users.models import User
14-
from apps.shared.mixins import CustomHtmxMixin, render_htmx_or_default
11+
from apps.shared.mixins import CustomHtmxMixin
1512
from .models import Post
1613
from .forms import (
1714
PostCreateUpdateForm,

apps/shared/management/commands/createadmin.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import os
22

3-
from dotenv import load_dotenv
3+
from django.contrib.auth import get_user_model
4+
from django.core.management import BaseCommand
45

6+
from dotenv import load_dotenv
57
load_dotenv()
68

7-
from django.contrib.auth import get_user_model
8-
from django.core.management.base import BaseCommand
9-
109

1110
ADMIN_USERNAME = str(os.getenv("ADMIN_USERNAME"))
1211
ADMIN_PASSWORD = str(os.getenv("ADMIN_PASSWORD"))
1312
ADMIN_EMAIL = str(os.getenv("ADMIN_PASSWORD"))
1413

1514

1615
class Command(BaseCommand):
16+
help = "Create superuser"
17+
1718
def handle(self, *args, **options):
1819
User = get_user_model()
1920
self.create_superuser(User, ADMIN_USERNAME, ADMIN_EMAIL, ADMIN_PASSWORD)

apps/users/tests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from django.urls import reverse
33

44
from .models import User, UserProfile
5-
from .services import generate_jwt_tokens
65
from .forms import RegisterForm, LoginForm
76

87
from rest_framework_simplejwt.tokens import RefreshToken, AccessToken

core/config/apps.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
DEFAULT_APPS = [
2-
# Default apps
32
"django.contrib.admin",
43
"django.contrib.auth",
54
"django.contrib.contenttypes",
@@ -10,14 +9,14 @@
109
"django.contrib.staticfiles",
1110
"django.contrib.postgres",
1211
]
12+
1313
PROJECT_APPS = [
14-
# Project apps
1514
"apps.shared.apps.SharedConfig",
1615
"apps.blog.apps.BlogConfig",
1716
"apps.users.apps.UsersConfig",
1817
]
18+
1919
THIRD_PARTY_APPS = [
20-
# Third party apps
2120
"rest_framework",
2221
"rest_framework_simplejwt",
2322
"rest_framework_simplejwt.token_blacklist",

core/settings/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ALLOWED_HOSTS = str(os.getenv("ALLOWED_HOSTS")).split(",")
1818

1919

20-
INSTALLED_APPS = DEFAULT_APPS + PROJECT_APPS + THIRD_PARTY_APPS
20+
INSTALLED_APPS = DEFAULT_APPS + PROJECT_APPS + THIRD_PARTY_APPS # NOQA
2121

2222

2323
MIDDLEWARE = [
@@ -34,7 +34,7 @@
3434
ROOT_URLCONF = "core.urls"
3535

3636

37-
TEMPLATES_DIRS = [os.path.join(BASE_DIR, "templates")]
37+
TEMPLATES_DIRS = [BASE_DIR.joinpath("templates")]
3838

3939
TEMPLATES = [
4040
{
@@ -52,6 +52,12 @@
5252
},
5353
]
5454

55+
DATABASES = {
56+
"default": {
57+
"ENGINE": "django.db.backends.sqlite3",
58+
"NAME": BASE_DIR.joinpath("db.sqlite3"),
59+
},
60+
}
5561

5662
WSGI_APPLICATION = "core.wsgi.application"
5763

@@ -83,16 +89,16 @@
8389
LOGIN_REDIRECT_URL = "/"
8490

8591
STATIC_URL = "static/"
86-
STATIC_ROOT = BASE_DIR / "staticfiles"
87-
STATICFILES_DIRS = [BASE_DIR / "static"]
92+
STATIC_ROOT = BASE_DIR.joinpath("staticfiles")
93+
STATICFILES_DIRS = [BASE_DIR.joinpath("static")]
8894

8995
# AUTHENTICATION_BACKENDS = (
9096
# 'apps.users.authentication.JWTAdminAuthentication',
9197
# 'django.contrib.auth.backends.ModelBackend',
9298
# )
9399

94100
MEDIA_URL = "media/"
95-
MEDIA_ROOT = BASE_DIR / "media/"
101+
MEDIA_ROOT = BASE_DIR.joinpath("media/")
96102

97103
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
98104

core/settings/development.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
11
from .base import * # noqa
22

33
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
4-
5-
DATABASES = {
6-
"default": {
7-
"ENGINE": f"django.db.backends.sqlite3",
8-
"NAME": BASE_DIR / "db.sqlite3",
9-
}
10-
}

core/settings/production.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
DATABASES = {
1414
"default": {
15-
"ENGINE": f"django.db.backends.postgresql",
15+
"ENGINE": "django.db.backends.postgresql",
1616
"NAME": str(os.getenv("DATABASE_NAME")),
1717
"USER": str(os.getenv("DATABASE_USER")),
1818
"PASSWORD": str(os.getenv("DATABASE_PASSWORD")),

core/wsgi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import os
22

3-
from dotenv import load_dotenv
3+
from django.core.wsgi import get_wsgi_application
44

5+
from dotenv import load_dotenv
56
load_dotenv()
67

7-
from django.core.wsgi import get_wsgi_application
8-
98
os.environ.setdefault(
109
"DJANGO_SETTINGS_MODULE",
1110
os.getenv("DJANGO_SETTINGS_MODULE", "core.settings.development"),

0 commit comments

Comments
 (0)