Commit e372e766 authored by hynek's avatar hynek 🤤
Browse files

style(*.py): change line width from 79 to 88

parent 8d52fe7b
......@@ -128,12 +128,8 @@ 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.CommonPasswordValidator"},
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
]
# MIDDLEWARE
......@@ -236,8 +232,7 @@ X_FRAME_OPTIONS = "DENY"
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend
EMAIL_BACKEND = env(
"DJANGO_EMAIL_BACKEND",
default="django.core.mail.backends.smtp.EmailBackend",
"DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.smtp.EmailBackend",
)
# https://docs.djangoproject.com/en/2.2/ref/settings/#email-timeout
EMAIL_TIMEOUT = 5
......@@ -247,12 +242,7 @@ EMAIL_TIMEOUT = 5
# Django Admin URL.
ADMIN_URL = "admin/"
# https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = [
(
"""Felix Herrmann, Stefan Hynek, Ubbo Veentjer""",
"info@discuss-data.net",
)
]
ADMINS = [("""Felix Herrmann, Stefan Hynek, Ubbo Veentjer""", "info@discuss-data.net",)]
# https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS
......@@ -283,9 +273,7 @@ LOGGING = {
# django-allauth
# ------------------------------------------------------------------------------
ACCOUNT_ALLOW_REGISTRATION = env.bool(
"DJANGO_ACCOUNT_ALLOW_REGISTRATION", True
)
ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True)
# https://django-allauth.readthedocs.io/en/latest/configuration.html
ACCOUNT_AUTHENTICATION_METHOD = "username"
# https://django-allauth.readthedocs.io/en/latest/configuration.html
......
......@@ -33,9 +33,7 @@ EMAIL_PORT = 1025
# WhiteNoise
# ------------------------------------------------------------------------------
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
INSTALLED_APPS = [
"whitenoise.runserver_nostatic"
] + INSTALLED_APPS # noqa F405
INSTALLED_APPS = ["whitenoise.runserver_nostatic"] + INSTALLED_APPS # noqa F405
# django-debug-toolbar
......
......@@ -12,9 +12,7 @@ ALLOWED_HOSTS = env.list("DJANGO_ALLOWED_HOSTS", default=["discuss-data.net"])
# ------------------------------------------------------------------------------
DATABASES["default"] = env.db("DATABASE_URL") # noqa F405
DATABASES["default"]["ATOMIC_REQUESTS"] = True # noqa F405
DATABASES["default"]["CONN_MAX_AGE"] = env.int( # noqa F405
"CONN_MAX_AGE", default=60
)
DATABASES["default"]["CONN_MAX_AGE"] = env.int("CONN_MAX_AGE", default=60) # noqa F405
# CACHES
# ------------------------------------------------------------------------------
......@@ -79,15 +77,12 @@ TEMPLATES[0]["OPTIONS"]["loaders"] = [ # noqa F405
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email
DEFAULT_FROM_EMAIL = env(
"DJANGO_DEFAULT_FROM_EMAIL",
default="Discuss Data <noreply@discuss-data.net>",
"DJANGO_DEFAULT_FROM_EMAIL", default="Discuss Data <noreply@discuss-data.net>",
)
# https://docs.djangoproject.com/en/dev/ref/settings/#server-email
SERVER_EMAIL = env("DJANGO_SERVER_EMAIL", default=DEFAULT_FROM_EMAIL)
# https://docs.djangoproject.com/en/dev/ref/settings/#email-subject-prefix
EMAIL_SUBJECT_PREFIX = env(
"DJANGO_EMAIL_SUBJECT_PREFIX", default="[Discuss Data]"
)
EMAIL_SUBJECT_PREFIX = env("DJANGO_EMAIL_SUBJECT_PREFIX", default="[Discuss Data]")
# ADMIN
# ------------------------------------------------------------------------------
......@@ -103,9 +98,7 @@ EMAIL_BACKEND = "anymail.backends.mailgun.EmailBackend"
ANYMAIL = {
"MAILGUN_API_KEY": env("MAILGUN_API_KEY"),
"MAILGUN_SENDER_DOMAIN": env("MAILGUN_DOMAIN"),
"MAILGUN_API_URL": env(
"MAILGUN_API_URL", default="https://api.mailgun.net/v3"
),
"MAILGUN_API_URL": env("MAILGUN_API_URL", default="https://api.mailgun.net/v3"),
}
# django-compressor
......@@ -128,9 +121,7 @@ COMPRESS_URL = STATIC_URL # noqa F405
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"filters": {
"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}
},
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
"formatters": {
"verbose": {
"format": "%(levelname)s %(asctime)s %(module)s "
......
......@@ -19,53 +19,37 @@ urlpatterns = [
# "about/", TemplateView.as_view(template_name="pages/about.html"), name="about"
# ),
# Django Admin, use {% url 'admin:index' %}
path(
settings.ADMIN_URL + "doc/", include("django.contrib.admindocs.urls")
),
path(settings.ADMIN_URL + "doc/", include("django.contrib.admindocs.urls")),
path(settings.ADMIN_URL, admin.site.urls),
# User management
path(
"users/",
include(("ddusers.urls", 'ddusers'), namespace="ddusers")
),
path("users/", include(("ddusers.urls", "ddusers"), namespace="ddusers")),
# next line to be removed
# path("accounts/", include("allauth.urls")),
# Your stuff: custom urls includes go here
path("core/", include(("core.urls", "core"), namespace="core")),
path(
"core/",
include(("core.urls", "core"), namespace="core")
),
path(
"dataset/",
include(("dddatasets.urls", "dddatasets"), namespace="dddatasets")
"dataset/", include(("dddatasets.urls", "dddatasets"), namespace="dddatasets")
),
path(
'login/',
auth_views.LoginView.as_view(template_name='auth/login.html', ),
name='login'
"login/",
auth_views.LoginView.as_view(template_name="auth/login.html",),
name="login",
),
path(
'logout/',
auth_views.LogoutView.as_view(template_name='auth/logout.html', ),
name='logout'
"logout/",
auth_views.LogoutView.as_view(template_name="auth/logout.html",),
name="logout",
),
path(
'shib/',
include('shibboleth.urls', namespace='shibboleth')
),
path(
'dhrep/',
include('dhrep.urls', namespace='dhrep')
),
path('', dashboard_page, name='ddusers.dashboard_page'),
path("shib/", include("shibboleth.urls", namespace="shibboleth")),
path("dhrep/", include("dhrep.urls", namespace="dhrep")),
path("", dashboard_page, name="ddusers.dashboard_page"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# wagtail URL def
urlpatterns += [
path('cms/', include(wagtailadmin_urls)),
path('documents/', include(wagtaildocs_urls)),
path('documentation/', include(wagtail_urls)),
path("cms/", include(wagtailadmin_urls)),
path("documents/", include(wagtaildocs_urls)),
path("documentation/", include(wagtail_urls)),
]
if settings.DEBUG:
......@@ -92,6 +76,4 @@ if settings.DEBUG:
if "debug_toolbar" in settings.INSTALLED_APPS:
import debug_toolbar
urlpatterns = [
path("__debug__/", include(debug_toolbar.urls))
] + urlpatterns
urlpatterns = [path("__debug__/", include(debug_toolbar.urls))] + urlpatterns
......@@ -12,10 +12,7 @@ def update_site_forward(apps, schema_editor):
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID,
defaults={
"domain": "discuss-data.net",
"name": "Discuss Data",
},
defaults={"domain": "discuss-data.net", "name": "Discuss Data",},
)
......
......@@ -9,129 +9,303 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
("contenttypes", "0002_remove_content_type_name"),
]
operations = [
migrations.CreateModel(
name='AffiliationTagged',
name="AffiliationTagged",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True, verbose_name='Name')),
('slug', models.SlugField(max_length=100, unique=True, verbose_name='Slug')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(max_length=100, unique=True, verbose_name="Name"),
),
(
"slug",
models.SlugField(max_length=100, unique=True, verbose_name="Slug"),
),
],
options={
'verbose_name': 'Affiliation Tag',
'verbose_name_plural': 'Affiliation Tags',
"verbose_name": "Affiliation Tag",
"verbose_name_plural": "Affiliation Tags",
},
),
migrations.CreateModel(
name='EnTagged',
name="EnTagged",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True, verbose_name='Name')),
('slug', models.SlugField(max_length=100, unique=True, verbose_name='Slug')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(max_length=100, unique=True, verbose_name="Name"),
),
(
"slug",
models.SlugField(max_length=100, unique=True, verbose_name="Slug"),
),
],
options={
'verbose_name': 'English Tag',
'verbose_name_plural': 'English Tags',
"verbose_name": "English Tag",
"verbose_name_plural": "English Tags",
},
),
migrations.CreateModel(
name='Keyword',
name="Keyword",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
('description', models.TextField(blank=True)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=200)),
("description", models.TextField(blank=True)),
],
),
migrations.CreateModel(
name='KeywordTagged',
name="KeywordTagged",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True, verbose_name='Name')),
('slug', models.SlugField(max_length=100, unique=True, verbose_name='Slug')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(max_length=100, unique=True, verbose_name="Name"),
),
(
"slug",
models.SlugField(max_length=100, unique=True, verbose_name="Slug"),
),
],
options={
'verbose_name': 'Keyword Tag',
'verbose_name_plural': 'Keyword Tags',
"verbose_name": "Keyword Tag",
"verbose_name_plural": "Keyword Tags",
},
),
migrations.CreateModel(
name='LanguageTagged',
name="LanguageTagged",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True, verbose_name='Name')),
('slug', models.SlugField(max_length=100, unique=True, verbose_name='Slug')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"name",
models.CharField(max_length=100, unique=True, verbose_name="Name"),
),
(
"slug",
models.SlugField(max_length=100, unique=True, verbose_name="Slug"),
),
],
options={
'verbose_name': 'Language Tag',
'verbose_name_plural': 'Language Tags',
"verbose_name": "Language Tag",
"verbose_name_plural": "Language Tags",
},
),
migrations.CreateModel(
name='Link',
name="Link",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.URLField()),
('doi', models.CharField(blank=True, max_length=200)),
('description', models.CharField(blank=True, max_length=400)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("url", models.URLField()),
("doi", models.CharField(blank=True, max_length=200)),
("description", models.CharField(blank=True, max_length=400)),
],
),
migrations.CreateModel(
name='Topic',
name="Topic",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
('description', models.TextField(blank=True)),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=200)),
("description", models.TextField(blank=True)),
],
),
migrations.CreateModel(
name='LanguageTags',
name="LanguageTags",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('object_id', models.IntegerField(db_index=True, verbose_name='Object id')),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='core_languagetags_tagged_items', to='contenttypes.ContentType', verbose_name='Content type')),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='languagetags_languagetagged', to='core.LanguageTagged')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"object_id",
models.IntegerField(db_index=True, verbose_name="Object id"),
),
(
"content_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="core_languagetags_tagged_items",
to="contenttypes.ContentType",
verbose_name="Content type",
),
),
(
"tag",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="languagetags_languagetagged",
to="core.LanguageTagged",
),
),
],
options={
'abstract': False,
},
options={"abstract": False,},
),
migrations.CreateModel(
name='KeywordTags',
name="KeywordTags",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('object_id', models.IntegerField(db_index=True, verbose_name='Object id')),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='core_keywordtags_tagged_items', to='contenttypes.ContentType', verbose_name='Content type')),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='keywordtags_keywordtagged', to='core.KeywordTagged')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"object_id",
models.IntegerField(db_index=True, verbose_name="Object id"),
),
(
"content_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="core_keywordtags_tagged_items",
to="contenttypes.ContentType",
verbose_name="Content type",
),
),
(
"tag",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="keywordtags_keywordtagged",
to="core.KeywordTagged",
),
),
],
options={
'abstract': False,
},
options={"abstract": False,},
),
migrations.CreateModel(
name='EnglishTags',
name="EnglishTags",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('object_id', models.IntegerField(db_index=True, verbose_name='Object id')),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='core_englishtags_tagged_items', to='contenttypes.ContentType', verbose_name='Content type')),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.EnTagged')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"object_id",
models.IntegerField(db_index=True, verbose_name="Object id"),
),
(
"content_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="core_englishtags_tagged_items",
to="contenttypes.ContentType",
verbose_name="Content type",
),
),
(
"tag",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="core.EnTagged"
),
),
],
options={
'abstract': False,
},
options={"abstract": False,},
),
migrations.CreateModel(
name='AffiliationTags',
name="AffiliationTags",
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('object_id', models.IntegerField(db_index=True, verbose_name='Object id')),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='core_affiliationtags_tagged_items', to='contenttypes.ContentType', verbose_name='Content type')),
('tag', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='affiliation_tags', to='core.AffiliationTagged')),
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"object_id",
models.IntegerField(db_index=True, verbose_name="Object id"),
),
(
"content_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="core_affiliationtags_tagged_items",
to="contenttypes.ContentType",
verbose_name="Content type",
),
),
(
"tag",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="affiliation_tags",
to="core.AffiliationTagged",
),
),
],
options={
'abstract': False,
},
options={"abstract": False,},
),
]
......@@ -46,9 +46,7 @@ class AffiliationTagged(TagBase):
class AffiliationTags(GenericTaggedItemBase):
tag = models.ForeignKey(
AffiliationTagged,
related_name="affiliation_tags",
on_delete=models.CASCADE,
AffiliationTagged, related_name="affiliation_tags", on_delete=models.CASCADE,
)
def __str__(self):
......
......@@ -10,20 +10,34 @@ class Migration(migrations.Migration):
initial = True
dependencies = [