Ticket #12836: test.diff

File test.diff, 791 bytes (added by Karataev Pavel, 15 years ago)
  • tests/modeltests/utils/models.py

     
     1from django.db import models
     2
     3def set_attr(name, value):
     4    def wrapper(function):
     5        setattr(function, name, value)
     6        return function
     7    return wrapper
     8
     9class Empty(models.Model):
     10    @models.permalink
     11    @set_attr('test', 'test')
     12    def get_absolute_url(self):
     13        pass
     14
     15__test__ = {'API_TESTS': """
     16# Access get_absolute_url attributes after in model instance.
     17>>> Empty().get_absolute_url.test == 'test'
     18True
     19"""}
Back to Top