#25088: Migrations fail when change upload_to from function to sting type
-------------------------------+------------------------
Reporter: argaliev | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords: Migrations
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------
In first migration function make_upload_path was passed to upload_to
property of FIleField:
{{{
def make_upload_path(instance, filename):
return 'auto_scripts/{0}/{1}'.format(instance.id,filename)
class file_imports(models.Model):
orig_file = models.FileField(upload_to=make_upload_path, blank=True,
null=True)
}}}
Then upload_to was changed to hardcoded string and function
make_upload_path was deleted.
{{{
orig_file = models.FileField(upload_to='auto_scripts/', blank=True,
null=True)
}}}
and getting following error when starting makemigrations:
{{{
......
File "...../main/migrations/0001_initial.py", line 108, in Migration
('orig_file', models.FileField(upload_to=main.models.make_upload_path,
null=True,
AttributeError: 'module' object has no attribute 'make_upload_path'
}}}
Looks like migrations still want to see old function make_upload_path in
code, but it does't need anymore.
--
Ticket URL: <https://code.djangoproject.com/ticket/25088>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.007a221633d2041c46f4a16844093f19%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.