image library

created using VS Codey Copilot Agent with Claude Sonnet 4
This commit is contained in:
Tobias Brunner 2025-07-04 16:28:13 +02:00
parent bdf06863d2
commit 52dbe89582
No known key found for this signature in database
14 changed files with 1366 additions and 3 deletions

View file

@ -4,10 +4,10 @@ from django.utils.text import slugify
from django_prose_editor.fields import ProseEditorField
def validate_image_size(value):
def validate_image_size(value, mb=1):
filesize = value.size
if filesize > 1 * 1024 * 1024: # 1MB
raise ValidationError("Maximum file size is 1MB")
if filesize > mb * 1024 * 1024:
raise ValidationError(f"Maximum file size is {mb} MB")
class Currency(models.TextChoices):