summaryrefslogtreecommitdiffstats
path: root/forum
diff options
context:
space:
mode:
authorsailingcai <sailingcai@gmail.com>2009-10-12 22:49:12 +0800
committersailingcai <sailingcai@gmail.com>2009-10-12 22:49:12 +0800
commitfb1574a51f55dc2de4275b2f682a74229230f8b8 (patch)
tree1712741adb98cb9e2c73b3c4d650bcc33128ff64 /forum
parentca1cf62b49f3f121459b9ebc114cdeb6535fabeb (diff)
downloadaskbot-fb1574a51f55dc2de4275b2f682a74229230f8b8.tar.gz
askbot-fb1574a51f55dc2de4275b2f682a74229230f8b8.tar.bz2
askbot-fb1574a51f55dc2de4275b2f682a74229230f8b8.zip
1. adjust logo css, remove margin-bottom
2. add urlquote in get_absolute_url 3. enable QuestionsPageSizeMiddleware middleware 4. remove unused code
Diffstat (limited to 'forum')
-rw-r--r--forum/models.py7
-rw-r--r--forum/views.py2
2 files changed, 4 insertions, 5 deletions
diff --git a/forum/models.py b/forum/models.py
index 255eb21f..a6326fa9 100644
--- a/forum/models.py
+++ b/forum/models.py
@@ -3,6 +3,7 @@ import datetime
import hashlib
from urllib import quote_plus, urlencode
from django.db import models
+from django.utils.http import urlquote as django_urlquote
from django.utils.html import strip_tags
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
@@ -180,7 +181,7 @@ class Question(models.Model):
return [name for name in self.tagnames.split(u' ')]
def get_absolute_url(self):
- return '%s%s' % (reverse('question', args=[self.id]), self.title.replace(' ', '-'))
+ return '%s%s' % (reverse('question', args=[self.id]), django_urlquote(self.title.replace(' ', '-')))
def has_favorite_by_user(self, user):
if not user.is_authenticated():
@@ -384,7 +385,7 @@ class Answer(models.Model):
return self.question.title
def get_absolute_url(self):
- return '%s%s#%s' % (reverse('question', args=[self.question.id]), self.question.title, self.id)
+ return '%s%s#%s' % (reverse('question', args=[self.question.id]), django_urlquote(self.question.title), self.id)
class Meta:
db_table = u'answer'
@@ -535,7 +536,7 @@ class Book(models.Model):
questions = models.ManyToManyField(Question, related_name='book', db_table='book_question')
def get_absolute_url(self):
- return '%s' % reverse('book', args=[self.short_name])
+ return '%s' % reverse('book', args=[django_urlquote(self.short_name)])
def __unicode__(self):
return self.title
diff --git a/forum/views.py b/forum/views.py
index dc38bcdf..377e7e8b 100644
--- a/forum/views.py
+++ b/forum/views.py
@@ -115,8 +115,6 @@ def questions(request, tagname=None, unanswered=False):
# template file
# "questions.html" or "unanswered.html"
template_file = "questions.html"
- # Set flag to False by default. If it is equal to True, then need to be saved.
- pagesize_changed = False
# get pagesize from session, if failed then get default value
pagesize = request.session.get("pagesize", 10)
try: