#StandWithUkraine
Today, 29th Январь 2023, Ukraine is still bravely fighting for democratic values, human rights and peace in whole world. Russians ruthlessly kill all civilians in Ukraine including childs and destroy their cities.
We are uniting against Putin’s invasion and violence, in support of the people in Ukraine. You can help by donating to Ukrainian's army.
Функцию для передачи в upload_to можно не задавать явно, а генерировать другой функцией, примерно так же, как работают декораторы. Получится что-то типа:
def get_upload_to(prefix):
def _tmp(instance, filename):
return os.path.join(instance.pk, prefix, filename)
return _tmp
avatar = models.FileField(upload_to=get_upload_to('avatars'))