Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#10347 closed (fixed)

AttributeError in FileDescriptor.__get__

Reported by: dc Owned by: nobody
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:

Description

How to reproduce:

>>> from django.db import models
>>> class MyModel(models.Model):
...    class Meta:
...        app_label = 'dummy'
...    file_field = models.FileField()
...
>>> MyModel.file_field
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "django/db/models/fields/files.py", line 118, in __get__
    raise AttributeError, "%s can only be accessed from %s instances." % (self.field.name(self.owner.__name__))
AttributeError: 'FileDescriptor' object has no attribute 'owner'

Attachments (1)

file-descriptor-error.patch (777 bytes) - added by dc 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by dc

comment:1 Changed 7 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from new to closed

(In [9902]) Fixed #10347 -- Fixed incorrect AttributeError raised when attempting to access a FileField without an instance. Thanks for the report and patch dc.

comment:2 Changed 7 years ago by kmtracey

(In [9903]) [1.0.X] Fixed #10347 -- Fixed incorrect AttributeError raised when attempting to access a FileField without an instance. Thanks for the report and patch dc.

[9902] from trunk. Also updated svnmerge metadata; all trunk changesets have either been merged or blocked.

Note: See TracTickets for help on using tickets.
Back to Top