From d8484ac2f413f91dff3ee0c0ff53115feea6632d Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 26 Apr 2011 00:43:19 +0530 Subject: [PATCH] added faqs, fixed bp bugs --- itf/bestpractices/admin.py | 1 + itf/bestpractices/models.py | 6 ++++++ itf/bestpractices/templatetags/guidelines.py | 11 +++++++---- itf/static/css/bestpractices.css | 1 + itf/templates/bestpractices.html | 2 ++ itf/templates/bpglossary.html | 2 ++ itf/templates/bpguidelines.html | 2 ++ itf/templates/bpstories.html | 2 ++ 8 files changed, 23 insertions(+), 4 deletions(-) diff --git a/itf/bestpractices/admin.py b/itf/bestpractices/admin.py index 1d4ae78..d85ce58 100644 --- a/itf/bestpractices/admin.py +++ b/itf/bestpractices/admin.py @@ -25,3 +25,4 @@ admin.site.register(BestPracticeLink) admin.site.register(Guideline) admin.site.register(Glossary) admin.site.register(BestPracticeDownload) +admin.site.register(BestPracticeFAQ) diff --git a/itf/bestpractices/models.py b/itf/bestpractices/models.py index 4ee8a74..aee62a5 100644 --- a/itf/bestpractices/models.py +++ b/itf/bestpractices/models.py @@ -96,6 +96,12 @@ class BestPracticeStory(models.Model): 'image': self.image.url if self.image.name != '' else '' } +class BestPracticeFAQ(models.Model): + question = models.TextField() + answer = models.TextField() + + def __unicode__(self): + return self.question class BestPracticeCategory(models.Model): name = models.CharField(max_length=256) diff --git a/itf/bestpractices/templatetags/guidelines.py b/itf/bestpractices/templatetags/guidelines.py index 3f3b772..b7ffde3 100644 --- a/itf/bestpractices/templatetags/guidelines.py +++ b/itf/bestpractices/templatetags/guidelines.py @@ -9,10 +9,13 @@ def link_bps(value): matches = re.findall(r, value) for match in matches: id = int(match.replace("BP:", "").strip()) - bp = BestPractice.objects.get(pk=id) - title = bp.title - html = "%s" % (id, title,) - value = value.replace(match, html, 1) + try: + bp = BestPractice.objects.get(pk=id) + title = bp.title + html = "%s" % (id, title,) + value = value.replace(match, html, 1) + except: + value = value.replace(match, '', 1) return value register.filter("link_bps", link_bps) diff --git a/itf/static/css/bestpractices.css b/itf/static/css/bestpractices.css index b37498b..473c614 100644 --- a/itf/static/css/bestpractices.css +++ b/itf/static/css/bestpractices.css @@ -50,6 +50,7 @@ h3 { font-weight: normal !important; font-style: italic; margin-left: 12px; + text-decoration: underline !important; } .bpRelated:hover { diff --git a/itf/templates/bestpractices.html b/itf/templates/bestpractices.html index dd83c84..4673ba7 100644 --- a/itf/templates/bestpractices.html +++ b/itf/templates/bestpractices.html @@ -71,6 +71,8 @@ $(document).ready(function() {
  • Stories
  • Guidelines
  • Glossary
  • +
  • FAQ
  • +
  • Download
  • diff --git a/itf/templates/bpglossary.html b/itf/templates/bpglossary.html index 6ae4e81..d75bfd2 100644 --- a/itf/templates/bpglossary.html +++ b/itf/templates/bpglossary.html @@ -7,6 +7,8 @@
  • Stories
  • Guidelines
  • Glossary
  • +
  • FAQ
  • +
  • Download
  • diff --git a/itf/templates/bpguidelines.html b/itf/templates/bpguidelines.html index b4b5f72..799e319 100644 --- a/itf/templates/bpguidelines.html +++ b/itf/templates/bpguidelines.html @@ -7,6 +7,8 @@
  • Stories
  • Guidelines
  • Glossary
  • +
  • FAQ
  • +
  • Download
  • diff --git a/itf/templates/bpstories.html b/itf/templates/bpstories.html index e4a659f..3fc14d6 100644 --- a/itf/templates/bpstories.html +++ b/itf/templates/bpstories.html @@ -7,6 +7,8 @@
  • Stories
  • Guidelines
  • Glossary
  • +
  • FAQ
  • +
  • Download