def items(self):
"""Return all the items for the Sitemap."""
return Board.objects.all()
python类Sitemap()的实例源码
def lastmod(self, obj): # pylint: disable=no-self-use
"""Return the last time the board or its content was structurally modified."""
# NOTE: self parameter is required to match the Sitemap interface
def _last_obj(class_):
return max((o.submit_date for o in class_.objects.filter(board=obj)), default=obj.pub_date)
return max([obj.pub_date, _last_obj(Evidence), _last_obj(Hypothesis)])