Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #45

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -15,28 +15,28 @@ 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:
- --py310-plus
- --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:
Expand All @@ -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
8 changes: 4 additions & 4 deletions voxpop/migrations/0008_alter_voxpop_allow_anonymous.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
]
12 changes: 8 additions & 4 deletions voxpop/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions voxpop/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion voxpop/static/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", {
Expand Down
2 changes: 1 addition & 1 deletion voxpop/static/thumbs-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion voxpop/static/voxpop.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ div[data-voxpop-uuid] form > .info {
background-color: #d4edda;
border: 1px solid #c3e6cb;
padding: 0.3em 0.5em;
}
}
4 changes: 2 additions & 2 deletions voxpop/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions voxpop_project/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions voxpop_project/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Django settings for voxpop project.
"""

from pathlib import Path

from environs import Env
Expand Down
1 change: 1 addition & 0 deletions voxpop_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions voxpop_project/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down