I want to enable sitemap-generation in Django, so I do the following, how it explained here
model:
class Car(models.Model): def __unicode__(self): return self.name name = models.CharField('Name', max_length=10) active = models.BooleanField()
urls:
car_dict = { 'queryset': Car.objects.filter(active=1), } sitemaps = { #'flatpages': FlatPageSitemap, 'car': GenericSitemap(car_dict, priority=0.5), }
But I have an error on /sitemap.xml: 'Car' object has no attribute 'get_absolute_url. How to fix it? I need to create some classes, how it explained here? Or I can use only GenericSitemap? I commented 'flatpages', because I dont use them. Thanks.
Update 1: in URLS.py:
url(r'^car/$', 'cars.views.shop'), url(r'^car/(?P<car_id>\d+)/$', 'cars.views.producer'),