added faqs, fixed bp bugs

This commit is contained in:
Sanj 2011-04-26 00:43:19 +05:30
parent 71f98a53fc
commit d8484ac2f4
8 changed files with 23 additions and 4 deletions

View File

@ -25,3 +25,4 @@ admin.site.register(BestPracticeLink)
admin.site.register(Guideline)
admin.site.register(Glossary)
admin.site.register(BestPracticeDownload)
admin.site.register(BestPracticeFAQ)

View File

@ -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)

View File

@ -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 = "<a class='bpRelated' href='/itf/bestpractices/stories#%d' title='View related Best Practice story'>%s</a>" % (id, title,)
value = value.replace(match, html, 1)
try:
bp = BestPractice.objects.get(pk=id)
title = bp.title
html = "<a class='bpRelated' href='/itf/bestpractices/stories#%d' title='View related Best Practice story'>%s</a>" % (id, title,)
value = value.replace(match, html, 1)
except:
value = value.replace(match, '', 1)
return value
register.filter("link_bps", link_bps)

View File

@ -50,6 +50,7 @@ h3 {
font-weight: normal !important;
font-style: italic;
margin-left: 12px;
text-decoration: underline !important;
}
.bpRelated:hover {

View File

@ -71,6 +71,8 @@ $(document).ready(function() {
<li><a href="/itf/bestpractices/stories">Stories</a></li>
<li><a href="/itf/bestpractices/guidelines">Guidelines</a></li>
<li><a href="/itf/bestpractices/glossary">Glossary</a></li>
<li><a href="/itf/bestpractices/faq">FAQ</a></li>
<li><a href="/itf/bestpractices/download">Download</a></li>
</ul>
</div>
<div style="clear:both;"></div>

View File

@ -7,6 +7,8 @@
<li><a href="/itf/bestpractices/stories">Stories</a></li>
<li><a href="/itf/bestpractices/guidelines">Guidelines</a></li>
<li class="bpCurrentTab">Glossary</li>
<li><a href="/itf/bestpractices/faq">FAQ</a></li>
<li><a href="/itf/bestpractices/download">Download</a></li>
</ul>
</div>
<div style="clear:both;"></div>

View File

@ -7,6 +7,8 @@
<li><a href="/itf/bestpractices/stories">Stories</a></li>
<li class="bpCurrentTab">Guidelines</li>
<li><a href="/itf/bestpractices/glossary">Glossary</a></li>
<li><a href="/itf/bestpractices/faq">FAQ</a></li>
<li><a href="/itf/bestpractices/download">Download</a></li>
</ul>
</div>
<div style="clear:both;"></div>

View File

@ -7,6 +7,8 @@
<li class="bpCurrentTab">Stories</li>
<li><a href="/itf/bestpractices/guidelines">Guidelines</a></li>
<li><a href="/itf/bestpractices/glossary">Glossary</a></li>
<li><a href="/itf/bestpractices/faq">FAQ</a></li>
<li><a href="/itf/bestpractices/download">Download</a></li>
</ul>
</div>
<div style="clear:both;"></div>