From 18f837de0568126108afe874a927b8439ad1546f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20St=C4=99pniowski?= Date: Wed, 10 Sep 2008 17:44:33 +0200 Subject: [PATCH] Added script setmainpage.py that sets initial main_page attributes for tags to repository. --- setmainpage.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 setmainpage.py diff --git a/setmainpage.py b/setmainpage.py new file mode 100755 index 000000000..245ed1d75 --- /dev/null +++ b/setmainpage.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from django.core.management import setup_environ +from wolnelektury import settings +import sys + +setup_environ(settings) + +from catalogue.models import Tag + + +MAIN_PAGE_THEMES = [ + u'Obywatel', + u'Car', + u'Błoto', + u'Krew', + u'Danse macabre', + u'Obcy', + u'Matka', + u'Gotycyzm', +] + + +for tag in Tag.objects.all(): + if tag.category in ('epoch', 'genre', 'author', 'kind'): + tag.main_page = True + elif tag.category == 'theme' and tag.name in MAIN_PAGE_THEMES: + tag.main_page = True + else: + tag.main_page = False + + tag.save() + sys.stderr.write('.') + + -- 2.20.1