I am trying to create a sitemap in Django but I am getting an error
'Post' object has no attribute 'get_absolute_url'
Here is my anotherfile/sitemap.py
from django.contrib.sitemaps import Sitemap
from somefile.models import Post
class site_map(Sitemap):
changefreq = "daily"
priority = 0.8
def items(self):
return Post.objects.all()
def lastmod(self, obj):
return obj.time_stamp
and here is my somefile/models.py
class Post(models.Model):
number=models.AutoField(primary_key=True)
slug=models.CharField(max_length=130)
time_stamp=models.DateTimeField(blank=True)
def __str__(self):
return self.number