我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.contrib.sitemaps.Sitemap()。
def items(self): """Return all the items for the Sitemap.""" return Board.objects.all()
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)])