diff options
| author | Tim Graham <timograham@gmail.com> | 2013-10-11 07:25:14 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-10-11 07:25:14 -0400 |
| commit | b67ab75e82ec59dd4eeca119eeaf570d7c88556c (patch) | |
| tree | 45bb072d08b4d7de7e6b76bf01fcd9bddcb43acd /django/db/models | |
| parent | 695bc0d191c126a948a7cf3acc3e37d9377ebd20 (diff) | |
Fixed assorted flake8 errors.
Diffstat (limited to 'django/db/models')
| -rw-r--r-- | django/db/models/base.py | 2 | ||||
| -rw-r--r-- | django/db/models/fields/files.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index 9409454d3e..c96507d5a1 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -164,7 +164,7 @@ class ModelBase(type): # Basic setup for proxy models. if is_proxy: base = None - for parent in [cls for cls in parents if hasattr(cls, '_meta')]: + for parent in [kls for kls in parents if hasattr(kls, '_meta')]: if parent._meta.abstract: if parent._meta.fields: raise TypeError("Abstract base class containing model fields not permitted for proxy model '%s'." % name) diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py index 557ec6ec8a..08ac4413a0 100644 --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -142,11 +142,14 @@ class FileDescriptor(object): The descriptor for the file attribute on the model instance. Returns a FieldFile when accessed so you can do stuff like:: + >>> from myapp.models import MyModel + >>> instance = MyModel.objects.get(pk=1) >>> instance.file.size Assigns a file object on assignment so you can do:: - >>> instance.file = File(...) + >>> with open('/tmp/hello.world', 'r') as f: + ... instance.file = File(f) """ def __init__(self, field): |
