Skip to content

Commit

Permalink
chore: Fix RUF012
Browse files Browse the repository at this point in the history
  • Loading branch information
marksweb committed Oct 26, 2023
1 parent 8a43b9f commit 05d7f0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/djangocms_snippet/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any, ClassVar

from django.conf import settings
from django.contrib import admin
from django.db import models
Expand All @@ -16,16 +18,16 @@ class Media:
)

list_display = ("slug", "name")
search_fields = ["slug", "name"]
prepopulated_fields = {"slug": ("name",)}
search_fields: ClassVar[list[str]] = ["slug", "name"]
prepopulated_fields: ClassVar[dict[str, list[str]]] = {"slug": ("name",)}
change_form_template = "djangocms_snippet/admin/change_form.html"
text_area_attrs = {
text_area_attrs: ClassVar[dict[str, Any]] = {
"rows": 20,
"data-editor": True,
"data-mode": getattr(settings, "DJANGOCMS_SNIPPET_THEME", "html"),
"data-theme": getattr(settings, "DJANGOCMS_SNIPPET_MODE", "github"),
}

formfield_overrides = {
formfield_overrides: ClassVar[dict[Any, dict[str, Any]]] = {
models.TextField: {"widget": Textarea(attrs=text_area_attrs)}
}
4 changes: 3 additions & 1 deletion src/djangocms_snippet/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import ClassVar

from cms.models import CMSPlugin
from django.conf import settings
from django.db import models
Expand Down Expand Up @@ -43,7 +45,7 @@ class Snippet(models.Model):
)

class Meta:
ordering = ["name"]
ordering: ClassVar[list[str]] = ["name"]
verbose_name = _("Snippet")
verbose_name_plural = _("Snippets")

Expand Down

0 comments on commit 05d7f0a

Please sign in to comment.