Allow SVG club logos

ImageField validates uploads through Pillow, which can't read SVGs, so
a club crest that's a vector logo was rejected outright. Switches to a
plain FileField with an extension allowlist (png/jpg/jpeg/gif/webp/svg)
instead, and restricts the file picker to image types via the widget's
accept attribute.
This commit is contained in:
2026-07-27 10:27:07 +02:00
parent 075c2918b6
commit 88a6c63f9f
3 changed files with 31 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ class ClubForm(forms.ModelForm):
widgets = {
"primary_color": forms.TextInput(attrs={"placeholder": "#1e40af"}),
"secondary_color": forms.TextInput(attrs={"placeholder": "#be185d"}),
"logo": forms.ClearableFileInput(attrs={"accept": "image/png,image/jpeg,image/gif,image/webp,image/svg+xml"}),
}
def __init__(self, *args, **kwargs):