Ticket #16022: fieldfile-weakref.patch

File fieldfile-weakref.patch, 675 bytes (added by Gustavo Narea, 13 years ago)

Fixed cyclic reference by making it a weak one

  • django/db/models/fields/files.py

     
    11import datetime
    22import os
     3import weakref
    34
    45from django.conf import settings
    56from django.db.models.fields import Field
     
    1718class FieldFile(File):
    1819    def __init__(self, instance, field, name):
    1920        super(FieldFile, self).__init__(None, name)
    20         self.instance = instance
     21        self.instance = weakref.ref(instance)
    2122        self.field = field
    2223        self.storage = field.storage
    2324        self._committed = True
Back to Top