mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-06-23 06:53:16 +03:00
Changed hardcoded /tmp/ directory to autodetect from system (#7292)
This commit is contained in:
parent
e275b9036a
commit
5828d8f7ca
|
@ -8,6 +8,7 @@ an appropriate set of serializer fields for each case.
|
||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
import django
|
import django
|
||||||
|
@ -71,7 +72,7 @@ class RegularFieldsModel(models.Model):
|
||||||
time_field = models.TimeField()
|
time_field = models.TimeField()
|
||||||
url_field = models.URLField(max_length=100)
|
url_field = models.URLField(max_length=100)
|
||||||
custom_field = CustomField()
|
custom_field = CustomField()
|
||||||
file_path_field = models.FilePathField(path='/tmp/')
|
file_path_field = models.FilePathField(path=tempfile.gettempdir())
|
||||||
|
|
||||||
def method(self):
|
def method(self):
|
||||||
return 'method'
|
return 'method'
|
||||||
|
@ -191,8 +192,8 @@ class TestRegularFieldMappings(TestCase):
|
||||||
time_field = TimeField()
|
time_field = TimeField()
|
||||||
url_field = URLField(max_length=100)
|
url_field = URLField(max_length=100)
|
||||||
custom_field = ModelField(model_field=<tests.test_model_serializer.CustomField: custom_field>)
|
custom_field = ModelField(model_field=<tests.test_model_serializer.CustomField: custom_field>)
|
||||||
file_path_field = FilePathField(path='/tmp/')
|
file_path_field = FilePathField(path=%r)
|
||||||
""")
|
""" % tempfile.gettempdir())
|
||||||
|
|
||||||
self.assertEqual(repr(TestSerializer()), expected)
|
self.assertEqual(repr(TestSerializer()), expected)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user