Skip to content
Browse files

Removed an inactive system check for upload_to.

Thanks to Simon Charette for the eagle eyes.
  • Loading branch information...
1 parent be8173a commit a029efca446025427a12ed886484890be15329d4 @freakboy3742 freakboy3742 committed
Showing with 0 additions and 30 deletions.
  1. +0 −14 django/db/models/fields/files.py
  2. +0 −16 tests/invalid_models_tests/test_ordinary_fields.py
View
14 django/db/models/fields/files.py
@@ -238,24 +238,10 @@ def __init__(self, verbose_name=None, name=None, upload_to='', storage=None, **k
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 [
View
16 tests/invalid_models_tests/test_ordinary_fields.py
@@ -302,22 +302,6 @@ class Model(models.Model):
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')

0 comments on commit a029efc

Please sign in to comment.
Something went wrong with that request. Please try again.