Skip to content

Commit a84f16c

Browse files
committed
Run black
1 parent 2491c5d commit a84f16c

File tree

11 files changed

+139
-96
lines changed

11 files changed

+139
-96
lines changed

example_project/example_project/asgi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.asgi import get_asgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example_project.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_project.settings")
1515

1616
application = get_asgi_application()

example_project/example_project/settings.py

+39-39
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
2121

2222
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = '(ww^*f5t2g9*bhh$!$f!ke0)(eq$)rj_(e2!z*_s@llf#h*+39'
23+
SECRET_KEY = "(ww^*f5t2g9*bhh$!$f!ke0)(eq$)rj_(e2!z*_s@llf#h*+39"
2424

2525
# SECURITY WARNING: don't run with debug turned on in production!
2626
DEBUG = True
@@ -31,85 +31,85 @@
3131
# Application definition
3232

3333
INSTALLED_APPS = [
34-
'django.contrib.admin',
35-
'django.contrib.auth',
36-
'django.contrib.contenttypes',
37-
'django.contrib.sessions',
38-
'django.contrib.messages',
39-
'django.contrib.staticfiles',
40-
'sortedm2m',
41-
'sortedm2m_filter_horizontal_widget',
42-
'my_app',
34+
"django.contrib.admin",
35+
"django.contrib.auth",
36+
"django.contrib.contenttypes",
37+
"django.contrib.sessions",
38+
"django.contrib.messages",
39+
"django.contrib.staticfiles",
40+
"sortedm2m",
41+
"sortedm2m_filter_horizontal_widget",
42+
"my_app",
4343
]
4444

4545
MIDDLEWARE = [
46-
'django.middleware.security.SecurityMiddleware',
47-
'django.contrib.sessions.middleware.SessionMiddleware',
48-
'django.middleware.common.CommonMiddleware',
49-
'django.middleware.csrf.CsrfViewMiddleware',
50-
'django.contrib.auth.middleware.AuthenticationMiddleware',
51-
'django.contrib.messages.middleware.MessageMiddleware',
52-
'django.middleware.clickjacking.XFrameOptionsMiddleware',
46+
"django.middleware.security.SecurityMiddleware",
47+
"django.contrib.sessions.middleware.SessionMiddleware",
48+
"django.middleware.common.CommonMiddleware",
49+
"django.middleware.csrf.CsrfViewMiddleware",
50+
"django.contrib.auth.middleware.AuthenticationMiddleware",
51+
"django.contrib.messages.middleware.MessageMiddleware",
52+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
5353
]
5454

55-
ROOT_URLCONF = 'example_project.urls'
55+
ROOT_URLCONF = "example_project.urls"
5656

5757
TEMPLATES = [
5858
{
59-
'BACKEND': 'django.template.backends.django.DjangoTemplates',
60-
'DIRS': [],
61-
'APP_DIRS': True,
62-
'OPTIONS': {
63-
'context_processors': [
64-
'django.template.context_processors.debug',
65-
'django.template.context_processors.request',
66-
'django.contrib.auth.context_processors.auth',
67-
'django.contrib.messages.context_processors.messages',
59+
"BACKEND": "django.template.backends.django.DjangoTemplates",
60+
"DIRS": [],
61+
"APP_DIRS": True,
62+
"OPTIONS": {
63+
"context_processors": [
64+
"django.template.context_processors.debug",
65+
"django.template.context_processors.request",
66+
"django.contrib.auth.context_processors.auth",
67+
"django.contrib.messages.context_processors.messages",
6868
],
6969
},
7070
},
7171
]
7272

73-
WSGI_APPLICATION = 'example_project.wsgi.application'
73+
WSGI_APPLICATION = "example_project.wsgi.application"
7474

7575

7676
# Database
7777
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
7878

7979
DATABASES = {
80-
'default': {
81-
'ENGINE': 'django.db.backends.sqlite3',
82-
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
80+
"default": {
81+
"ENGINE": "django.db.backends.sqlite3",
82+
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
8383
}
8484
}
8585

86-
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
86+
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
8787

8888
# Password validation
8989
# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
9090

9191
AUTH_PASSWORD_VALIDATORS = [
9292
{
93-
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
93+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
9494
},
9595
{
96-
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
96+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
9797
},
9898
{
99-
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
99+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
100100
},
101101
{
102-
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
102+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
103103
},
104104
]
105105

106106

107107
# Internationalization
108108
# https://docs.djangoproject.com/en/3.0/topics/i18n/
109109

110-
LANGUAGE_CODE = 'en-us'
110+
LANGUAGE_CODE = "en-us"
111111

112-
TIME_ZONE = 'UTC'
112+
TIME_ZONE = "UTC"
113113

114114
USE_I18N = True
115115

@@ -121,4 +121,4 @@
121121
# Static files (CSS, JavaScript, Images)
122122
# https://docs.djangoproject.com/en/3.0/howto/static-files/
123123

124-
STATIC_URL = '/static/'
124+
STATIC_URL = "/static/"

example_project/example_project/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
from django.urls import path
1818

1919
urlpatterns = [
20-
path('admin/', admin.site.urls),
20+
path("admin/", admin.site.urls),
2121
]

example_project/example_project/wsgi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.wsgi import get_wsgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example_project.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_project.settings")
1515

1616
application = get_wsgi_application()

example_project/manage.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
def main():
8-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example_project.settings')
8+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_project.settings")
99
try:
1010
from django.core.management import execute_from_command_line
1111
except ImportError as exc:
@@ -17,5 +17,5 @@ def main():
1717
execute_from_command_line(sys.argv)
1818

1919

20-
if __name__ == '__main__':
20+
if __name__ == "__main__":
2121
main()

example_project/my_app/admin.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66
@admin.register(Book)
77
class BookAdmin(admin.ModelAdmin):
88
filter_horizontal = ["authors"]
9+
910
def formfield_for_manytomany(self, db_field, request=None, **kwargs):
10-
if db_field.name == 'authors':
11-
kwargs['widget'] = SortedFilteredSelectMultiple()
12-
return super(BookAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
11+
if db_field.name == "authors":
12+
kwargs["widget"] = SortedFilteredSelectMultiple()
13+
return super(BookAdmin, self).formfield_for_manytomany(
14+
db_field, request, **kwargs
15+
)
1316

1417

1518
@admin.register(Author)
1619
class AuthorAdmin(admin.ModelAdmin):
1720
pass
1821

22+
1923
@admin.register(Publisher)
2024
class PublisherAdmin(admin.ModelAdmin):
2125
pass

example_project/my_app/apps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class MyAppConfig(AppConfig):
5-
name = 'my_app'
5+
name = "my_app"

example_project/my_app/migrations/0001_initial.py

+29-10
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,45 @@
55

66

77
class Migration(migrations.Migration):
8-
98
initial = True
109

11-
dependencies = [
12-
]
10+
dependencies = []
1311

1412
operations = [
1513
migrations.CreateModel(
16-
name='Author',
14+
name="Author",
1715
fields=[
18-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
19-
('name', models.CharField(max_length=100)),
16+
(
17+
"id",
18+
models.AutoField(
19+
auto_created=True,
20+
primary_key=True,
21+
serialize=False,
22+
verbose_name="ID",
23+
),
24+
),
25+
("name", models.CharField(max_length=100)),
2026
],
2127
),
2228
migrations.CreateModel(
23-
name='Book',
29+
name="Book",
2430
fields=[
25-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
26-
('name', models.CharField(max_length=100)),
27-
('authors', sortedm2m.fields.SortedManyToManyField(help_text=None, to='my_app.Author')),
31+
(
32+
"id",
33+
models.AutoField(
34+
auto_created=True,
35+
primary_key=True,
36+
serialize=False,
37+
verbose_name="ID",
38+
),
39+
),
40+
("name", models.CharField(max_length=100)),
41+
(
42+
"authors",
43+
sortedm2m.fields.SortedManyToManyField(
44+
help_text=None, to="my_app.Author"
45+
),
46+
),
2847
],
2948
),
3049
]

pyproject.toml

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ readme = "README.md"
88
packages = [{include = "sortedm2m_filter_horizontal_widget"}]
99

1010
[tool.poetry.dependencies]
11-
python = "^3.5"
11+
python = "^3.8"
1212
django-sortedm2m = "^3.1.1"
1313

1414

15+
[tool.poetry.group.dev.dependencies]
16+
black = "^23.7.0"
17+
1518
[build-system]
1619
requires = ["poetry-core"]
1720
build-backend = "poetry.core.masonry.api"
21+
22+
[tool.black]
23+
line-length = 88
24+
target-version = ['py38']
25+
include = '\.pyi?$'
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
# -*- coding: utf-8 -*-
2-
3-
4-
__version__ = '1.3.2'

0 commit comments

Comments
 (0)