add image extensions
This commit is contained in:
@@ -103,7 +103,7 @@ class BillCreateForm(forms.ModelForm):
|
||||
"affiliation": "Abrechnungsbudget",
|
||||
"payer": "Ursprüngliche Bezahlmethode",
|
||||
"only_digital": "Ich habe nur eine digitale Rechnung.",
|
||||
"file_field": "Rechnung hochladen (PDF)",
|
||||
"file_field": "Rechnung hochladen (PDF- und Bildformate erlaubt)",
|
||||
"comment": "Kommentar",
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class BillUpdateForm(forms.ModelForm):
|
||||
"affiliation": "Abrechnungsbudget",
|
||||
"payer": "Wie wurde die Rechnung bezahlt?",
|
||||
"only_digital": "Ich habe nur eine digitale Rechnung.",
|
||||
"file_field": "Neue Rechnung hochladen (PDF)",
|
||||
"file_field": "Neue Rechnung hochladen (PDF- und Bildformate erlaubt)",
|
||||
"comment": "Kommentar",
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ class BillAdminForm(forms.ModelForm):
|
||||
"amount": "Betrag (EUR)",
|
||||
"comment": "Kommentar",
|
||||
"date": "Rechnungsdatum",
|
||||
"file_field": "Rechnung hochladen (PDF)",
|
||||
"file_field": "Rechnung hochladen (PDF- und Bildformate erlaubt)",
|
||||
"invoice": "Rechnungsaussteller",
|
||||
"only_digital": "Ich habe nur eine digitale Rechnung.",
|
||||
"payer": "Wie wurde die Rechnung bezahlt?",
|
||||
|
||||
@@ -6,6 +6,8 @@ from django.urls import reverse
|
||||
|
||||
from members.models import Member
|
||||
|
||||
from .validators import validate_bill_file_extension
|
||||
|
||||
|
||||
class BankData(models.Model):
|
||||
# members can be deleted but never their bank datas
|
||||
@@ -246,7 +248,7 @@ class Bill(models.Model):
|
||||
|
||||
file_field = models.FileField(
|
||||
upload_to="uploads/finance/bills/",
|
||||
validators=[FileExtensionValidator(["pdf"])],
|
||||
validators=[validate_bill_file_extension],
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
|
||||
5
fet2020/finance/validators.py
Normal file
5
fet2020/finance/validators.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from django.core.validators import FileExtensionValidator, get_available_image_extensions
|
||||
|
||||
|
||||
def validate_bill_file_extension(value):
|
||||
return FileExtensionValidator([*["pdf"], *get_available_image_extensions()])(value)
|
||||
Reference in New Issue
Block a user