import datetime
import logging
from urllib import unquote
-from django.conf import settings as django_settings
+from forum import settings as django_settings
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseForbidden, Http404, HttpResponsePermanentRedirect
from django.core.paginator import Paginator, EmptyPage, InvalidPage
from forum.utils.diff import textDiff as htmldiff
from forum.forms import *
from forum.models import *
-from forum.const import *
from forum.utils.forms import get_next_url
from forum.actions import QuestionViewAction
from forum.modules.decorators import decoratable
@decorators.render('questions.html', 'unanswered')
def unanswered(request):
return question_list(request, Question.objects.filter(extra_ref=None),
- _('Open questions without an accepted answer'))
+ _('Open questions without an accepted answer'),
+ 'active', None, _("Unanswered questions"))
@decorators.render('questions.html', 'questions')
def questions(request):
- return question_list(request, Question.objects.all())
+ return question_list(request, Question.objects.all(), _('questions'), 'active')
@decorators.render('questions.html')
def tag(request, tag):
return question_list(request, Question.objects.filter(tags__name=unquote(tag)),
- mark_safe(_('Questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}))
+ mark_safe(_('Questions tagged <span class="tag">%(tag)s</span>') % {'tag': tag}),
+ 'active', None, mark_safe(_('Questions tagged %(tag)s') % {'tag': tag}))
@decorators.list('questions', QUESTIONS_PAGE_SIZE)
-def question_list(request, initial, list_description=_('questions'), sort=None, base_path=None):
+def question_list(request, initial, list_description=_('questions'), sort=None, base_path=None, page_title=None):
questions = initial.filter(deleted=None, in_moderation=None)
if request.user.is_authenticated():
questions=questions.order_by(view_dic.get(sort, '-added_at'))
+ if page_title is None:
+ page_title = _("Questions")
+
return {
"questions" : questions,
"questions_count" : questions.count(),
#"tags_autocomplete" : _get_tags_cache_json(),
"list_description": list_description,
"base_path" : base_path,
+ "page_title" : page_title,
}
last_seen = request.session['last_seen_in_question'].get(question.id,None)
if (not last_seen) or last_seen < question.last_activity_at:
- QuestionViewAction(question, request.user).save()
+ QuestionViewAction(question, request.user, ip=request.META['REMOTE_ADDR']).save()
request.session['last_seen_in_question'][question.id] = datetime.datetime.now()
request.session['last_seen_in_question'][question.id] = datetime.datetime.now()
else:
rev_ctx[i]['summary'] = revision.summary
- return render_to_response('revisions_question.html', {
+ return render_to_response('revisions.html', {
'post': post,
'revisions': rev_ctx,
}, context_instance=RequestContext(request))