Example of customization of a representation method

[ permalink ] [ download ]
# http://www.djangoproject.com/documentation/tutorial01/

import datetime
# ...
class Poll(models.Model):
    # ...
    def was_published_today(self):
        return self.pub_date.date() == datetime.date.today()
hits counter