Customizing Django-Fack¶
Customizing templates¶
The one thing you’ll probably want to do quickly is to make some custom templates so that the FAQ app “fits” with the rest of your site. Django-Fack uses the following templates:
Template name Use faq/base.htmlThe base template that all the other included templates extend by default. For a quick and dirty customization you can just override this one template, making sure to provide a
contentblock, and everything’ll look OK.But to get a more custom feel you’ll probably want to move on
faq/question_detail.htmlUsed by an individual “question” detail page.
The context has one variable,
question, which is theQuestionobject.faq/submit_question.htmlUsed by the view that allows users to submit a question.
The context has the obligatory
formvariable, which is a form containingtopic,text, andanswerfields.faq/submit_thanks.htmlShown after a successful FAQ submission. No context. faq/topic_detail.htmlShows all the FAQs in a given topic.
- Context:
topic- aTopic.questions- list ofQuestionobjects in the given topic.faq/topic_list.htmlShows a list of all topics. Context contains a topicvariable, which is aTopicobject.
Subclassing FAQ views¶
All of the views in Django-Fack use class-based generic views and are designed to be extended. Consulting the source is your best bet here: the code’s fairly clear, and prose will only complicate things.
If you do choose to subclass views, you’ll most likely want to write your
own URLconf (instead of fack.urls). Remember that if you maintain the
names given by the default URLconf all the existing links will continue
to work.