~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to pybb/views.py

  • Committer: franku
  • Date: 2018-04-26 20:18:55 UTC
  • mfrom: (489.1.28 widelands)
  • Revision ID: somal@arcor.de-20180426201855-uwt3b8gptpav6wrm
updated code base to fit with django 1.11.12; replaced app tracking with a new middleware

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
from django.contrib.auth.models import User
8
8
from django.contrib.auth.decorators import login_required
9
9
from django.conf import settings
10
 
from django.core.urlresolvers import reverse
 
10
from django.urls import reverse
11
11
from django.db import connection
12
12
from django.utils import translation
13
13
from django.shortcuts import render
88
88
    topic.views += 1
89
89
    topic.save()
90
90
 
91
 
    if request.user.is_authenticated():
 
91
    if request.user.is_authenticated:
92
92
        topic.update_read(request.user)
93
93
 
94
94
    if pybb_settings.FREEZE_FIRST_POST:
98
98
    last_post = topic.posts.order_by('-created')[0]
99
99
 
100
100
    initial = {}
101
 
    if request.user.is_authenticated():
 
101
    if request.user.is_authenticated:
102
102
        initial = {'markup': 'markdown'}
103
103
    form = AddPostForm(topic=topic, initial=initial)
104
104
 
105
105
    moderator = (request.user.is_superuser or
106
106
                 request.user in topic.forum.moderators.all())
107
 
    subscribed = (request.user.is_authenticated() and
 
107
    subscribed = (request.user.is_authenticated and
108
108
                  request.user in topic.subscribers.all())
109
109
 
110
110
    posts = topic.posts.exclude(hidden=True).select_related()