Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1. adjust logo css, remove margin-bottom

2. add urlquote in get_absolute_url
3. enable QuestionsPageSizeMiddleware middleware
4. remove unused code
  • Loading branch information...
commit fb1574a51f55dc2de4275b2f682a74229230f8b8 1 parent ca1cf62
@sailingcai sailingcai authored
View
7 forum/models.py
@@ -3,6 +3,7 @@
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 @@ def tagname_list(self):
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 @@ def get_question_title(self):
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
View
2  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:
View
2  settings.py
@@ -36,7 +36,7 @@
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.transaction.TransactionMiddleware',
#'django.middleware.sqlprint.SqlPrintingMiddleware',
- #'middleware.pagesize.QuestionsPageSizeMiddleware',
+ 'middleware.pagesize.QuestionsPageSizeMiddleware',
#'debug_toolbar.middleware.DebugToolbarMiddleware',
)
View
1  templates/content/style/style.css
@@ -108,7 +108,6 @@ blockquote
margin-left:20px;text-decoration:underline; font-size:12px; color:#333333;}
#logo {
padding: 5px 0px 0px 0px;
- margin-bottom:-3px;
}
#navBar {float:clear;position:relative;display:block;width:960px;}
#navBar .nav {margin:20px 0px 0px 16px;
Please sign in to comment.
Something went wrong with that request. Please try again.