Skip to content

Commit

Permalink
Register transforms for FileField. Fix #60
Browse files Browse the repository at this point in the history
It turns out the existing transformations were not registered.

Also add a test for #60.
  • Loading branch information
atodorov committed Apr 10, 2018
1 parent 4b2515a commit 784ac40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pylint_django/tests/input/func_noerror_model_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def durationfield_tests(self):
print(self.durationfield.total_seconds())

def filefield_tests(self):
self.filefield.save('/dev/null', 'TEST')
print(self.filefield.file)
self.imagefield.save('/dev/null', 'TEST')
print(self.imagefield.file)

def numberfield_tests(self):
Expand Down
2 changes: 2 additions & 0 deletions pylint_django/transforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ def set_fake_locals(module):
'Manager')
_add_transform('django.utils.translation', 'ugettext_lazy')
_add_transform('mongoengine', 'Document')
# register transform for FileField/ImageField, see #60
_add_transform('django.db.models.fields.files', 'FileField')

0 comments on commit 784ac40

Please sign in to comment.