Run black on all files

This commit is contained in:
Jon Banafato
2019-11-17 16:59:14 -05:00
parent e5a634d805
commit 72403bd981
18 changed files with 170 additions and 150 deletions

View File

@@ -20,7 +20,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '@(9b9jslgg41u1u=mr)-2*-n2x0vef0zsy39*z@sz18&tvow18'
SECRET_KEY = "@(9b9jslgg41u1u=mr)-2*-n2x0vef0zsy39*z@sz18&tvow18"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@@ -31,54 +31,54 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'interface',
'interface.templatetags'
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"interface",
"interface.templatetags",
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = 'frontend.urls'
ROOT_URLCONF = "frontend.urls"
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
WSGI_APPLICATION = 'frontend.wsgi.application'
WSGI_APPLICATION = "frontend.wsgi.application"
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
@@ -88,26 +88,20 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",},
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",},
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"
TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"
USE_I18N = True
@@ -119,4 +113,4 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_URL = "/static/"

View File

@@ -18,6 +18,6 @@ from django.urls import path
from interface import views
urlpatterns = [
path('admin/', admin.site.urls),
path('', views.index, name='index'),
path("admin/", admin.site.urls),
path("", views.index, name="index"),
]

View File

@@ -11,6 +11,6 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'frontend.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "frontend.settings")
application = get_wsgi_application()

View File

@@ -2,4 +2,4 @@ from django.apps import AppConfig
class InterfaceConfig(AppConfig):
name = 'interface'
name = "interface"

View File

@@ -7,21 +7,28 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
]
dependencies = []
operations = [
migrations.CreateModel(
name='books',
name="books",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('author', models.CharField(blank=True, max_length=255)),
('categories', models.CharField(blank=True, max_length=255)),
('cover', models.BinaryField(blank=True, editable=True)),
('pages', models.IntegerField(blank=True)),
('progress', models.IntegerField(blank=True)),
('file_name', models.CharField(max_length=255)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
("author", models.CharField(blank=True, max_length=255)),
("categories", models.CharField(blank=True, max_length=255)),
("cover", models.BinaryField(blank=True, editable=True)),
("pages", models.IntegerField(blank=True)),
("progress", models.IntegerField(blank=True)),
("file_name", models.CharField(max_length=255)),
],
),
]

View File

@@ -14,8 +14,9 @@ class Books(models.Model):
:param progress: Reader percentage <-- Not implented
:param file_name: Path to book
"""
class Meta:
db_table = 'books'
db_table = "books"
def __str__(self):
return self.title
@@ -30,4 +31,4 @@ class Books(models.Model):
def get_absolute_url(self):
"""Returns the url to access a particular instance of MyModelName."""
return reverse('model-detail-view', args=[str(self.id)])
return reverse("model-detail-view", args=[str(self.id)])

View File

@@ -7,4 +7,5 @@ register = template.Library()
@register.filter
def bin_2_img(_bin):
if _bin is not None: return b64encode(_bin).decode('utf-8')
if _bin is not None:
return b64encode(_bin).decode("utf-8")

View File

@@ -4,12 +4,12 @@ from .models import Books
def index(request):
return render(request, "index.html", {'Books': Books.objects.all()})
return render(request, "index.html", {"Books": Books.objects.all()})
def book_set(_set):
r = 20
x = _set*r
x = _set * r
y = x + r
books = Books.objects.all()[x:y]
return books

View File

@@ -5,7 +5,7 @@ import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'frontend.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "frontend.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@@ -17,5 +17,5 @@ def main():
execute_from_command_line(sys.argv)
if __name__ == '__main__':
if __name__ == "__main__":
main()