Login

FileFieldSitemap for the sitemap framework

Author:
m_aciek
Posted:
May 30, 2016
Language:
Python
Version:
1.7
Score:
0 (after 0 ratings)

Snippet is a class for the sitemap framework which lists files.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from django.contrib.sitemaps import Sitemap
from blog.models import Entry

class FileFieldSitemap(Sitemap):
    changefreq = "never"
    priority = 0.5

    def items(self):
        return [e.file for e in Entry.objects.all() if bool(e.file) is not False]

    def location(self, item):
        return item.url

More like this

  1. Month / Year SelectDateWidget based on django SelectDateWidget by pierreben 2 weeks, 4 days ago
  2. Python Django CRUD Example Tutorial by tuts_station 1 month ago
  3. Browser-native date input field by kytta 2 months, 2 weeks ago
  4. Generate and render HTML Table by LLyaudet 2 months, 3 weeks ago
  5. My firs Snippets by GutemaG 3 months ago

Comments

Please login first before commenting.