Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed an inactive system check for upload_to.

Thanks to Simon Charette for the eagle eyes.
  • Loading branch information...
commit a029efca446025427a12ed886484890be15329d4 1 parent be8173a
@freakboy3742 freakboy3742 authored
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')
Please sign in to comment.
Something went wrong with that request. Please try again.