hzdg / django-modeltools

Enums in your models, template strings for FileField names…

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Django 1.7 migrations and format_filename

ryanbagwell opened this issue · comments

Django 1.7 won't make migrations with the format_filename function because it has an included function called 'upload_to', which it returns. When running makemigrations, Django attempts to serialize a path to 'upload_to,' which doesn't actually exist, and the command fails.

Django offers this explanation:

Please note that due to Python 2 limitations, you cannot serialize
unbound method functions (e.g. a method declared and used in the
same class body). Please move the function into the main module body
to use migrations. For more information, see
https://docs.djangoproject.com/en/1.7/topics/migrations/#serializing-values

I'm not sure what to do about this.

@kenzic Didn't you fix this? Did you forget to push or am I thinking of something different?

Yeah! @ryanbagwell you should use https://github.com/hzdg/django-upload-to for 1.7+. I'll bring it up at TWII. Thanks @matthewwithanm