From 5a17c1e401e936a3c7c5e8ce183387373b7198ce Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:58:12 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v5.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.9.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.9.2) - [github.com/asottile/reorder-python-imports: v3.12.0 → v3.14.0](https://github.com/asottile/reorder-python-imports/compare/v3.12.0...v3.14.0) - [github.com/asottile/pyupgrade: v3.15.0 → v3.19.1](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.19.1) - [github.com/adamchainz/django-upgrade: 1.15.0 → 1.22.2](https://github.com/adamchainz/django-upgrade/compare/1.15.0...1.22.2) - [github.com/psf/black: 23.9.1 → 24.10.0](https://github.com/psf/black/compare/23.9.1...24.10.0) --- .pre-commit-config.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2896318..7fe438b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ default_language_version: python: python3.11 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-ast - id: check-merge-conflict @@ -15,13 +15,13 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.0.292' + rev: 'v0.9.2' hooks: - id: ruff args: - --fix - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + rev: v3.14.0 hooks: - id: reorder-python-imports args: @@ -29,14 +29,14 @@ repos: - --application-directories=.:src exclude: migrations/ - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 + rev: v3.19.1 hooks: - id: pyupgrade args: - --py310-plus exclude: migrations/ - repo: https://github.com/adamchainz/django-upgrade - rev: 1.15.0 + rev: 1.22.2 hooks: - id: django-upgrade args: @@ -50,6 +50,6 @@ repos: hooks: - id: add-trailing-comma - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 24.10.0 hooks: - id: black From 8b9eb07a5cc5a5d82e85a53e3b2cdfb29993e338 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:58:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../migrations/0008_alter_voxpop_allow_anonymous.py | 8 ++++---- voxpop/selectors.py | 12 ++++++++---- voxpop/signals.py | 4 ++-- voxpop/static/admin.js | 2 +- voxpop/static/thumbs-up.svg | 2 +- voxpop/static/voxpop.css | 2 +- voxpop/views.py | 4 ++-- voxpop_project/asgi.py | 1 + voxpop_project/settings.py | 1 + voxpop_project/urls.py | 1 + voxpop_project/wsgi.py | 1 + 11 files changed, 23 insertions(+), 15 deletions(-) diff --git a/voxpop/migrations/0008_alter_voxpop_allow_anonymous.py b/voxpop/migrations/0008_alter_voxpop_allow_anonymous.py index f0747be..1b0c579 100644 --- a/voxpop/migrations/0008_alter_voxpop_allow_anonymous.py +++ b/voxpop/migrations/0008_alter_voxpop_allow_anonymous.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('voxpop', '0007_message_channel_name'), + ("voxpop", "0007_message_channel_name"), ] operations = [ migrations.AlterField( - model_name='voxpop', - name='allow_anonymous', - field=models.BooleanField(default=True, verbose_name='allow anonymous'), + model_name="voxpop", + name="allow_anonymous", + field=models.BooleanField(default=True, verbose_name="allow anonymous"), ), ] diff --git a/voxpop/selectors.py b/voxpop/selectors.py index 1ae1923..f0192e5 100644 --- a/voxpop/selectors.py +++ b/voxpop/selectors.py @@ -96,9 +96,13 @@ def get_votes( async def get_messages(channel_name: str, last_event_id: int) -> list[Message]: messages = [] - async for message in Message.objects.all().filter( - channel_name=channel_name, - id__gt=last_event_id, - ).order_by("id"): + async for message in ( + Message.objects.all() + .filter( + channel_name=channel_name, + id__gt=last_event_id, + ) + .order_by("id") + ): messages.append(message) return messages diff --git a/voxpop/signals.py b/voxpop/signals.py index 46e79f0..91211f8 100644 --- a/voxpop/signals.py +++ b/voxpop/signals.py @@ -64,12 +64,12 @@ def notify_question_state_changed(sender, instance, *args, **kwargs): @receiver(post_save, sender=Question) def notify_question_created(sender, instance, created, **kwargs): if created: - channel_name = get_notify_channel_name(voxpop_id=instance.voxpop_id) + channel_name = get_notify_channel_name(voxpop_id=instance.voxpop_id) payload = { "uuid": str(instance.uuid), "text": str(instance.text), "display_name": str(instance.display_name), - "created_at": str(instance.created_at), + "created_at": str(instance.created_at), } message = create_message( voxpop_id=instance.voxpop_id, diff --git a/voxpop/static/admin.js b/voxpop/static/admin.js index 7f83607..7b9f459 100644 --- a/voxpop/static/admin.js +++ b/voxpop/static/admin.js @@ -97,7 +97,7 @@ clone.querySelector("div[data-voxpop-question-uuid]").setAttribute("data-voxpop-question-uuid", question.uuid); clone.querySelector("blockquote").innerText = question.text; clone.querySelector(".displayName").innerText = question.display_name; - + // Format time. const datetime = new Date(question.created_at); const formattedTime = datetime.toLocaleTimeString("da", { diff --git a/voxpop/static/thumbs-up.svg b/voxpop/static/thumbs-up.svg index 1c2153e..aa73b1b 100644 --- a/voxpop/static/thumbs-up.svg +++ b/voxpop/static/thumbs-up.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/voxpop/static/voxpop.css b/voxpop/static/voxpop.css index 14c3ce4..f5b50b9 100644 --- a/voxpop/static/voxpop.css +++ b/voxpop/static/voxpop.css @@ -120,4 +120,4 @@ div[data-voxpop-uuid] form > .info { background-color: #d4edda; border: 1px solid #c3e6cb; padding: 0.3em 0.5em; -} \ No newline at end of file +} diff --git a/voxpop/views.py b/voxpop/views.py index 6edf8ef..1ad3abc 100644 --- a/voxpop/views.py +++ b/voxpop/views.py @@ -110,7 +110,7 @@ def admin_voxpop(request, voxpop_id: UUID = None): state=Question.State.DISCARDED, ), }, - "idp": voxpop.organisation.idp + "idp": voxpop.organisation.idp, } return render(request, "voxpop/admin/voxpop.html", context) return render(request, "voxpop/admin/auth_error.html") @@ -180,7 +180,7 @@ def index(request): if voxpop: context = { "voxpop": voxpop, - "idp": voxpop.organisation.idp + "idp": voxpop.organisation.idp, } return render(request, "voxpop/index.html", context) diff --git a/voxpop_project/asgi.py b/voxpop_project/asgi.py index 14982d6..ada849b 100644 --- a/voxpop_project/asgi.py +++ b/voxpop_project/asgi.py @@ -6,6 +6,7 @@ For more information on this file, see https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/ """ + import os from django.core.asgi import get_asgi_application diff --git a/voxpop_project/settings.py b/voxpop_project/settings.py index d0ec73f..68c40b7 100644 --- a/voxpop_project/settings.py +++ b/voxpop_project/settings.py @@ -1,6 +1,7 @@ """ Django settings for voxpop project. """ + from pathlib import Path from environs import Env diff --git a/voxpop_project/urls.py b/voxpop_project/urls.py index 9636388..c564864 100644 --- a/voxpop_project/urls.py +++ b/voxpop_project/urls.py @@ -13,6 +13,7 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.contrib import admin from django.urls import include from django.urls import path diff --git a/voxpop_project/wsgi.py b/voxpop_project/wsgi.py index 99e282d..cbca039 100644 --- a/voxpop_project/wsgi.py +++ b/voxpop_project/wsgi.py @@ -6,6 +6,7 @@ For more information on this file, see https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/ """ + import os from django.core.wsgi import get_wsgi_application