Ticket #12836: fix.diff

File fix.diff, 1.8 KB (added by Karataev Pavel, 15 years ago)
  • django/db/models/base.py

     
    1515from django.db.models.loading import register_models, get_model
    1616from django.utils.translation import ugettext_lazy as _
    1717import django.utils.copycompat as copy
    18 from django.utils.functional import curry
     18from django.utils.functional import curry, wraps
    1919from django.utils.encoding import smart_str, force_unicode, smart_unicode
    2020from django.utils.text import get_text_list, capfirst
    2121from django.conf import settings
     
    228228            cls.__doc__ = "%s(%s)" % (cls.__name__, ", ".join([f.attname for f in opts.fields]))
    229229
    230230        if hasattr(cls, 'get_absolute_url'):
    231             cls.get_absolute_url = curry(get_absolute_url, opts, cls.get_absolute_url)
     231            cls.get_absolute_url = wraps(cls.get_absolute_url)(
     232                curry(get_absolute_url, opts, cls.get_absolute_url)
     233            )
    232234
    233235        signals.class_prepared.send(sender=cls)
    234236
  • django/db/models/__init__.py

     
    1212from django.db.models.fields.files import FileField, ImageField
    1313from django.db.models.fields.related import ForeignKey, OneToOneField, ManyToManyField, ManyToOneRel, ManyToManyRel, OneToOneRel
    1414from django.db.models import signals
     15from django.utils.functional import wraps
    1516
    1617# Admin stages.
    1718ADD, CHANGE, BOTH = 1, 2, 3
     
    2728        (viewname, viewargs, viewkwargs)
    2829    """
    2930    from django.core.urlresolvers import reverse
     31    @wraps(func)
    3032    def inner(*args, **kwargs):
    3133        bits = func(*args, **kwargs)
    3234        return reverse(bits[0], None, *bits[1:3])
Back to Top