Closed L7G9 closed 4 weeks ago
Can use slugify to turn string in valid file name
from django.utils.text import slugify def get_filename(in_string, extension="pdf"): return f"{slugify(in_string)}.{pdf}"
Make sure timeline title is alphanumeric only
from django.core.validators import RegexValidator alphanumeric = RegexValidator(r'^[0-9a-zA-Z]*$', 'Only alphanumeric characters are allowed.') title = models.CharField(max_length=100, validators=[alphanumeric])
fixed 25/8/25 see timelines.pdf.get_filename
Instead of identical filename for pdf could use timeline title to make file name. Would need to make sure it was valid.