Upgrade black

This commit is contained in:
Gabriel Augendre 2020-09-05 09:09:59 +02:00
parent 2085f0bc89
commit 37175e54fb
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
16 changed files with 34 additions and 27 deletions

View file

@ -24,7 +24,7 @@ repos:
- id: isort - id: isort
types: [python] types: [python]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 19.10b0 rev: 20.8b1
hooks: hooks:
- id: black - id: black
types: [python] types: [python]

View file

@ -17,9 +17,12 @@ class Command(BaseCommand):
url = (settings.BLOG["base_url"] + url).replace( url = (settings.BLOG["base_url"] + url).replace(
"//", "/" "//", "/"
) + "?status__exact=pending" ) + "?status__exact=pending"
message = ngettext( message = (
ngettext(
"There is %(count)d comment pending review.\n%(url)s", "There is %(count)d comment pending review.\n%(url)s",
"There are %(count)d comments pending review.\n%(url)s", "There are %(count)d comments pending review.\n%(url)s",
count, count,
) % {"count": count, "url": url} )
% {"count": count, "url": url}
)
mail_admins("Comments pending review", message) mail_admins("Comments pending review", message)

View file

@ -125,6 +125,6 @@ class Migration(migrations.Migration):
"verbose_name_plural": "users", "verbose_name_plural": "users",
"abstract": False, "abstract": False,
}, },
managers=[("objects", django.contrib.auth.models.UserManager()),], managers=[("objects", django.contrib.auth.models.UserManager())],
), ),
] ]

View file

@ -45,6 +45,6 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"ordering": ["-published_at"],}, options={"ordering": ["-published_at"]},
), ),
] ]

View file

@ -11,9 +11,9 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="page", options={"ordering": ["position", "-published_at"]}, name="page", options={"ordering": ["position", "-published_at"]}
), ),
migrations.AddField( migrations.AddField(
model_name="page", name="position", field=models.IntegerField(default=0), model_name="page", name="position", field=models.IntegerField(default=0)
), ),
] ]

View file

@ -11,7 +11,7 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="comment", options={"ordering": ["-created_at"]}, name="comment", options={"ordering": ["-created_at"]}
), ),
migrations.AddField( migrations.AddField(
model_name="comment", model_name="comment",

View file

@ -11,6 +11,6 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RenameField( migrations.RenameField(
model_name="comment", old_name="active", new_name="approved", model_name="comment", old_name="active", new_name="approved"
), ),
] ]

View file

@ -11,7 +11,7 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="comment", options={"ordering": ["created_at"]}, name="comment", options={"ordering": ["created_at"]}
), ),
migrations.AlterField( migrations.AlterField(
model_name="comment", model_name="comment",

View file

@ -10,7 +10,7 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RemoveField(model_name="comment", name="approved",), migrations.RemoveField(model_name="comment", name="approved"),
migrations.AddField( migrations.AddField(
model_name="comment", model_name="comment",
name="status", name="status",

View file

@ -11,6 +11,6 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="comment", options={"ordering": ["-created_at"]}, name="comment", options={"ordering": ["-created_at"]}
), ),
] ]

View file

@ -11,6 +11,6 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="comment", options={"ordering": ["created_at"]}, name="comment", options={"ordering": ["created_at"]}
), ),
] ]

View file

@ -89,9 +89,7 @@ class ArticleDetailView(FormMixin, generic.DetailView):
comment = form.save(commit=False) comment = form.save(commit=False)
comment.article = self.object comment.article = self.object
comment.save() comment.save()
messages.success( messages.success(self.request, "Comment successfully saved, pending review.")
self.request, "Comment successfully saved, pending review.",
)
return super().form_valid(form) return super().form_valid(form)
def get_success_url(self): def get_success_url(self):

View file

@ -11,9 +11,14 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RenameField( migrations.RenameField(
model_name="attachment", old_name="file", new_name="original_file", model_name="attachment",
old_name="file",
new_name="original_file",
),
migrations.RemoveField(
model_name="attachment",
name="processed",
), ),
migrations.RemoveField(model_name="attachment", name="processed",),
migrations.AddField( migrations.AddField(
model_name="attachment", model_name="attachment",
name="processed_file", name="processed_file",

View file

@ -11,6 +11,7 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="attachment", options={"ordering": ["description"]}, name="attachment",
options={"ordering": ["description"]},
), ),
] ]

View file

@ -65,7 +65,7 @@ class Attachment(models.Model):
} }
check_data = {**base_data, **post_data} check_data = {**base_data, **post_data}
while res_data["Status"]["Code"] == "1": while res_data["Status"]["Code"] == "1":
response = requests.post(url=url, data=check_data,) response = requests.post(url=url, data=check_data)
res_data = response.json()[0] res_data = response.json()[0]
# Download image # Download image

View file

@ -130,11 +130,11 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [ AUTH_PASSWORD_VALIDATORS = [
{ {
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
}, },
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",}, {"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",}, {"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",}, {"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
] ]