Ticket #7173: related_cache_r7513.patch

File related_cache_r7513.patch, 567 bytes (added by George Vilches, 17 years ago)

Patch from Travis Terry using related_name for the cache field name.

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

     
    165165    # SingleRelatedObjectDescriptor instance.
    166166    def __init__(self, related):
    167167        self.related = related
    168         self.cache_name = '_%s_cache' % related.field.name
     168        self.cache_name = '_%s_cache' % related.get_accessor_name()
    169169
    170170    def __get__(self, instance, instance_type=None):
    171171        if instance is None:
Back to Top