1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #31812 -- Fixed FileField.model for fields defined in abstract models.

Regression in a93425a37f.
This commit is contained in:
Matthias Kestenholz
2020-07-23 01:38:31 +02:00
committed by Mariusz Felisiak
parent 41065cfed5
commit c1f8d87bb0
2 changed files with 24 additions and 1 deletions

View File

@@ -299,6 +299,10 @@ class FileField(Field):
file.save(file.name, file.file, save=False)
return file
def contribute_to_class(self, cls, name, **kwargs):
super().contribute_to_class(cls, name, **kwargs)
setattr(cls, self.attname, self.descriptor_class(self))
def generate_filename(self, instance, filename):
"""
Apply (if callable) or prepend (if a string) upload_to to the filename,