#29529: Allow FilePathField path to accept a callable.
-------------------------------------+-------------------------------------
Reporter: Sebastiaan Arendsen | Owner: Vasyl
| Dizhak
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: migration, | Triage Stage: Accepted
filepathfield, makemigrations |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Herbert Fortes):
Hi,
If I only change self.path in forms/fields.py, right after {{{ __init__
}}} I get this error:
{{{
File "/home/hpfn/Documentos/Programacao/python/testes/.venv/lib/python3.6
/site-packages/django/forms/fields.py", line 1106, in __init__
self.choices.append((f, f.replace(path, "", 1)))
TypeError: replace() argument 1 must be str, not function
}}}
The 'path' param is used a few lines after. There is one more time. Line
1106 can be wrong.
If I put in {{{models/fields/__init__.py}}} - after super():
{{{
if callable(self.path):
self.path = self.path()
}}}
I can run 'python manage.py runserver'
--
Ticket URL: <https://code.djangoproject.com/ticket/29529#comment:14>
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/067.f6512146998515599ba7e8a05133279c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.