Removed an inactive system check for upload_to.
Thanks to Simon Charette for the eagle eyes.
This commit is contained in:
parent
be8173af51
commit
a029efca44
|
@ -238,24 +238,10 @@ class FileField(Field):
|
|||
|
||||
def check(self, **kwargs):
|
||||
errors = super(FileField, self).check(**kwargs)
|
||||
#errors.extend(self._check_upload_to())
|
||||
errors.extend(self._check_unique())
|
||||
errors.extend(self._check_primary_key())
|
||||
return errors
|
||||
|
||||
def _check_upload_to(self):
|
||||
if not self.upload_to:
|
||||
return [
|
||||
checks.Error(
|
||||
'The field requires an "upload_to" attribute.',
|
||||
hint=None,
|
||||
obj=self,
|
||||
id='E031',
|
||||
)
|
||||
]
|
||||
else:
|
||||
return []
|
||||
|
||||
def _check_unique(self):
|
||||
if self._unique_set_explicitly:
|
||||
return [
|
||||
|
|
|
@ -302,22 +302,6 @@ class FileFieldTests(IsolatedModelsTestCase):
|
|||
expected = []
|
||||
self.assertEqual(errors, expected)
|
||||
|
||||
# def test_missing_upload_to(self):
|
||||
# class Model(models.Model):
|
||||
# field = models.FileField()
|
||||
|
||||
# field = Model._meta.get_field('field')
|
||||
# errors = field.check()
|
||||
# expected = [
|
||||
# Error(
|
||||
# 'The field requires an "upload_to" attribute.',
|
||||
# hint=None,
|
||||
# obj=field,
|
||||
# id='E031',
|
||||
# ),
|
||||
# ]
|
||||
# self.assertEqual(errors, expected)
|
||||
|
||||
def test_unique(self):
|
||||
class Model(models.Model):
|
||||
field = models.FileField(unique=False, upload_to='somewhere')
|
||||
|
|
Loading…
Reference in New Issue