Mercurial > public > sg101
changeset 189:db202792d9f5
Explicitly set session settings. Use the cache_db engine. Some minor tweaks to reduce some queries in forums.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 01 Apr 2010 01:39:37 +0000 |
parents | d293b423bdaf |
children | 0e4961833cdf |
files | gpp/forums/views.py gpp/settings.py |
diffstat | 2 files changed, 18 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/forums/views.py Wed Mar 31 01:58:20 2010 +0000 +++ b/gpp/forums/views.py Thu Apr 01 01:39:37 2010 +0000 @@ -19,6 +19,7 @@ from django.template import RequestContext from django.views.decorators.http import require_POST from django.utils.text import wrap +from django.db.models import F from core.paginator import DiggPaginator from core.functions import email_admins @@ -152,13 +153,14 @@ """ Displays all the posts in a topic. """ - topic = get_object_or_404(Topic.objects.select_related(), pk=id) + topic = get_object_or_404(Topic.objects.select_related( + 'forum', 'forum__category', 'last_post'), pk=id) if not topic.forum.category.can_access(request.user): return HttpResponseForbidden() - topic.view_count += 1 - topic.save() + topic.view_count = F('view_count') + 1 + topic.save(force_update=True) posts = topic.posts.select_related()
--- a/gpp/settings.py Wed Mar 31 01:58:20 2010 +0000 +++ b/gpp/settings.py Thu Apr 01 01:39:37 2010 +0000 @@ -177,6 +177,19 @@ #CACHE_MIDDLEWARE_ANONYMOUS_ONLY = local_settings.CACHE_MIDDLEWARE_ANONYMOUS_ONLY ####################################################################### +# Sessions +####################################################################### +#SESSION_ENGINE = "django.contrib.sessions.backends.db" +SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" +SESSION_COOKIE_AGE = 2 * 7 * 24 * 60 * 60 # 2 weeks in seconds +SESSION_COOKIE_DOMAIN = None +SESSION_COOKIE_NAME = 'sg101_sessionid' +SESSION_COOKIE_PATH = '/' +SESSION_COOKIE_SECURE = False +SESSION_EXPIRE_AT_BROWSER_CLOSE = False +SESSION_SAVE_EVERY_REQUEST = False + +####################################################################### # Tagging Specific Settings ####################################################################### FORCE_LOWERCASE_TAGS = True