mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #29529 -- Allowed models.fields.FilePathField to accept a callable path.
This commit is contained in:
parent
11971cd87c
commit
ef082ebb84
4 changed files with 30 additions and 1 deletions
|
@ -10,3 +10,13 @@ class FilePathFieldTests(SimpleTestCase):
|
|||
field = FilePathField(path=path)
|
||||
self.assertEqual(field.path, path)
|
||||
self.assertEqual(field.formfield().path, path)
|
||||
|
||||
def test_callable_path(self):
|
||||
path = os.path.dirname(__file__)
|
||||
|
||||
def generate_path():
|
||||
return path
|
||||
|
||||
field = FilePathField(path=generate_path)
|
||||
self.assertEqual(field.path(), path)
|
||||
self.assertEqual(field.formfield().path, path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue