widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #16111
[Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
kaputtnik has proposed merging lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/pybb_cleanup/+merge/363742
A big cleanup on pybb:
- removed model pybb Privatemessage and all related functions since we use Django Messages
- removed field moderators from pybb Forum, since we use django Group for this
- removed other unused functions
- removed pybb pagination and related functions since we use dj_pagination for that
- removed option PYBB_FREEZE_FIRST_POST. This was meant to show the first post of a topic on each sub page. We never used this and i never saw this in other forums.
- removed some templates which were not used
Additional changes:
- added table headers 'Forum' and 'Last Post on Topic' to forum categories
- added table headers 'Forum' and 'Last Post' to topics overview
- changed appearance of the link to last post in topics overview (see https://bugs.launchpad.net/widelands-website/+bug/1762164/comments/9)
- changed the admin site for pybb topics: Instead showing the topic subscribers, the related posts of a topic are shown
- it is now possible to search for a topics name in the admin page for pybb post
To get this in:
make a database backup
merge the branch
run python manage.py migrate
run python mangage.py collectstatic -l
restart wlwebsite
After success, check the database: The table pybb_privatemessage may has to be removed by hand
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website.
=== modified file 'mainpage/templates/mainpage/forum_navigation.html'
--- mainpage/templates/mainpage/forum_navigation.html 2018-12-12 13:46:48 +0000
+++ mainpage/templates/mainpage/forum_navigation.html 2019-02-27 20:07:53 +0000
@@ -8,7 +8,9 @@
<a href="{% url 'pybb_forum' forum.id %}" style="color: rgba(254, 234, 138, 1);">{{ forum.name }}</a>
</li>
{% else %}
- <li><a href="{% url 'pybb_forum' forum.id %}">{{ forum.name }}</a></li>
+ <li>
+ <a href="{% url 'pybb_forum' forum.id %}">{{ forum.name }}</a>
+ </li>
{% endif %}
{% endfor %}
</ul>
=== modified file 'pybb/admin.py'
--- pybb/admin.py 2018-12-11 13:01:59 +0000
+++ pybb/admin.py 2019-02-27 20:07:53 +0000
@@ -44,13 +44,18 @@
(_('Additional options'), {
'description': 'Position is the position inside the category. \
This has effect on ordering in forums overview and the navigation bar.',
- 'fields': ('position', 'description', 'moderators')
+ 'fields': ('position', 'description')
}
),
)
-
-class SubscribersInline(admin.TabularInline):
- model = Topic.subscribers.through
+
+
+class PostInline(admin.TabularInline):
+ model = Post
+ readonly_fields = ('user', 'markup', 'created',)
+ exclude = ('created', 'updated', 'body',)
+ ordering = ('-created',)
+
class TopicAdmin(admin.ModelAdmin):
list_display = ['name', 'forum', 'created', 'head', 'is_hidden']
@@ -58,6 +63,7 @@
ordering = ['-created']
date_hierarchy = 'created'
search_fields = ['name']
+ inlines = [PostInline,]
fieldsets = (
(None, {
'fields': ('forum', 'name', 'user', ('created', 'updated'))
@@ -67,7 +73,6 @@
'fields': (('views',), ('sticky', 'closed'),)
}),
)
- inlines = [ SubscribersInline, ]
class PostAdmin(admin.ModelAdmin):
@@ -75,7 +80,7 @@
list_per_page = 20
ordering = ['-created']
date_hierarchy = 'created'
- search_fields = ['body']
+ search_fields = ['body', 'topic__name']
actions = [delete_selected, unhide_post]
fieldsets = (
(None, {
=== modified file 'pybb/forms.py'
--- pybb/forms.py 2018-10-03 09:01:09 +0000
+++ pybb/forms.py 2019-02-27 20:07:53 +0000
@@ -7,7 +7,7 @@
from django.utils.translation import ugettext as _
from django.contrib.auth.models import User
-from pybb.models import Topic, Post, PrivateMessage, Attachment
+from pybb.models import Topic, Post, Attachment
from pybb import settings as pybb_settings
from django.conf import settings
@@ -87,14 +87,3 @@
post.updated = datetime.now()
post.save(*args, **kwargs)
return post
-
-
-class UserSearchForm(forms.Form):
- query = forms.CharField(required=False, label='')
-
- def filter(self, qs):
- if self.is_valid():
- query = self.cleaned_data['query']
- return qs.filter(username__contains=query)
- else:
- return qs
=== added file 'pybb/migrations/0005_auto_20181221_1047.py'
--- pybb/migrations/0005_auto_20181221_1047.py 1970-01-01 00:00:00 +0000
+++ pybb/migrations/0005_auto_20181221_1047.py 2019-02-27 20:07:53 +0000
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.12 on 2018-12-21 10:47
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('pybb', '0004_auto_20181209_1334'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='privatemessage',
+ name='dst_user',
+ ),
+ migrations.RemoveField(
+ model_name='privatemessage',
+ name='src_user',
+ ),
+ migrations.RemoveField(
+ model_name='forum',
+ name='moderators',
+ ),
+ migrations.DeleteModel(
+ name='PrivateMessage',
+ ),
+ ]
=== modified file 'pybb/models.py'
--- pybb/models.py 2018-12-18 18:42:06 +0000
+++ pybb/models.py 2019-02-27 20:07:53 +0000
@@ -12,7 +12,7 @@
from django.conf import settings
from pybb.markups import mypostmarkup
-from pybb.util import urlize, memoize_method, unescape
+from pybb.util import urlize, unescape
from pybb import settings as pybb_settings
from django.conf import settings
@@ -85,8 +85,6 @@
name = models.CharField(_('Name'), max_length=80)
position = models.IntegerField(_('Position'), blank=True, default=0)
description = models.TextField(_('Description'), blank=True, default='')
- moderators = models.ManyToManyField(
- User, blank=True, verbose_name=_('Moderators'))
updated = models.DateTimeField(_('Updated'), null=True)
moderator_group = models.ForeignKey(
Group,
@@ -361,48 +359,6 @@
return u'T[%d], U[%d]: %s' % (self.topic.id, self.user.id, unicode(self.time))
-class PrivateMessage(RenderableItem):
-
- dst_user = models.ForeignKey(User, verbose_name=_(
- 'Recipient'), related_name='dst_users')
- src_user = models.ForeignKey(User, verbose_name=_(
- 'Author'), related_name='src_users')
- read = models.BooleanField(_('Read'), blank=True, default=False)
- created = models.DateTimeField(_('Created'), blank=True)
- markup = models.CharField(_('Markup'), max_length=15,
- default=pybb_settings.DEFAULT_MARKUP, choices=MARKUP_CHOICES)
- subject = models.CharField(_('Subject'), max_length=255)
- body = models.TextField(_('Message'))
- body_html = models.TextField(_('HTML version'))
- body_text = models.TextField(_('Text version'))
-
- class Meta:
- ordering = ['-created']
- verbose_name = _('Private message')
- verbose_name_plural = _('Private messages')
-
- # TODO: summary and part of the save method is the same as in the Post model
- # move to common functions
- def summary(self):
- LIMIT = 50
- tail = len(self.body) > LIMIT and '...' or ''
- return self.body[:LIMIT] + tail
-
- def __unicode__(self):
- return self.subject
-
- def save(self, *args, **kwargs):
- if self.created is None:
- self.created = datetime.now()
- self.render()
-
- new = self.id is None
- super(PrivateMessage, self).save(*args, **kwargs)
-
- def get_absolute_url(self):
- return reverse('pybb_show_pm', args=[self.id])
-
-
class Attachment(models.Model):
post = models.ForeignKey(Post, verbose_name=_(
'Post'), related_name='attachments')
=== modified file 'pybb/settings.py'
--- pybb/settings.py 2016-12-13 18:28:51 +0000
+++ pybb/settings.py 2019-02-27 20:07:53 +0000
@@ -6,27 +6,18 @@
TOPIC_PAGE_SIZE = get('PYBB_TOPIC_PAGE_SIZE', 10)
FORUM_PAGE_SIZE = get('PYBB_FORUM_PAGE_SIZE', 20)
-USERS_PAGE_SIZE = get('PYBB_USERS_PAGE_SIZE', 20)
AVATARS_UPLOAD_TO = get('PYBB_AVATARS_UPLOAD_TO', 'pybb/avatars')
AVATAR_WIDTH = get('PYBB_AVATAR_WIDTH', 60)
AVATAR_HEIGHT = get('PYBB_AVATAR_HEIGHT', 60)
DEFAULT_TIME_ZONE = get('PYBB_DEFAULT_TIME_ZONE', 3)
SIGNATURE_MAX_LENGTH = get('PYBB_SIGNATURE_MAX_LENGTH', 1024)
SIGNATURE_MAX_LINES = get('PYBB_SIGNATURE_MAX_LINES', 3)
-QUICK_TOPICS_NUMBER = get('PYBB_QUICK_TOPICS_NUMBER', 10)
-QUICK_POSTS_NUMBER = get('PYBB_QUICK_POSTS_NUMBER', 10)
READ_TIMEOUT = get('PYBB_READ_TIMEOUT', 3600 * 24 * 7)
-HEADER = get('PYBB_HEADER', 'PYBB')
-TAGLINE = get('PYBB_TAGLINE', 'Django based forum engine')
DEFAULT_MARKUP = get('PYBB_DEFAULT_MARKUP', 'bbcode')
-NOTICE = get('PYBB_NOTICE', '')
-HOST = get('PYBB_HOST', 'localhost:8000')
-FREEZE_FIRST_POST = get('PYBB_FREEZE_FIRST_POST', True)
-ADMIN_URL = get('PYBB_ADMIN_URL', '/admin/')
-EMAIL_DEBUG = get('PYBB_EMAIL_DEBUG', False)
ATTACHMENT_UPLOAD_TO = get('PYBB_ATTACHMENT_UPLOAD_TO', 'pybb/attachments')
ATTACHMENT_SIZE_LIMIT = get('PYBB_ATTACHMENT_SIZE_LIMIT', 1024 * 1024)
ATTACHMENT_ENABLE = get('PYBB_ATTACHMENT_ENABLE', True)
+INTERNAL_PERM = get('INTERNAL_PERM', 'pybb.can_access_internal')
# That is used internally
DISABLE_NOTIFICATION = False
=== modified file 'pybb/signals.py'
--- pybb/signals.py 2016-12-13 18:28:51 +0000
+++ pybb/signals.py 2019-02-27 20:07:53 +0000
@@ -1,7 +1,7 @@
from django.db.models.signals import post_save
from django.contrib.auth.models import User
-from pybb.models import Post, PrivateMessage
+from pybb.models import Post
def post_saved(instance, **kwargs):
=== modified file 'pybb/static/css/forum.css'
--- pybb/static/css/forum.css 2018-11-22 17:50:41 +0000
+++ pybb/static/css/forum.css 2019-02-27 20:07:53 +0000
@@ -25,6 +25,10 @@
border: none;
}
+.forum th {
+ font-weight: normal;
+}
+
.forum td {
vertical-align: middle;
padding: 8px;
@@ -40,6 +44,7 @@
.forumTitle {
width: 40%;
+ text-align: left;
}
.forumCount {
=== modified file 'pybb/templates/pybb/forum.html'
--- pybb/templates/pybb/forum.html 2018-12-10 16:37:12 +0000
+++ pybb/templates/pybb/forum.html 2019-02-27 20:07:53 +0000
@@ -43,10 +43,10 @@
<table class="forum">
<thead>
<tr>
- <td class="forumIcon"></td>
- <td class="forumTitle small">Title</td>
- <td class="forumCount"></td>
- <td class="lastPost small">Last Post by</td>
+ <th class="forumIcon"></th>
+ <th class="forumTitle small">Topic</th>
+ <th class="forumCount"></th>
+ <th class="lastPost small">Last Post</th>
</tr>
</thead>
<tbody>
@@ -71,9 +71,9 @@
Views: {{ topic.views }}
</td>
<td class="lastPost">
- {%if topic.last_post %}
- {{ topic.last_post.user|user_link }} <a href="{{ topic.last_post.get_absolute_url }}">»</a><br />
- <span class="small">on {{ topic.last_post.created|custom_date:user }}</span>
+ {% if topic.last_post %}
+ <a href="{{ topic.last_post.get_absolute_url }}">{{ topic.last_post|truncatechars:30 }}</a><br />
+ <span class="small">by {{ topic.last_post.user|user_link }} on {{ topic.last_post.created|custom_date:user }}</span>
{% endif %}
</td>
{% elif user_is_mod %}
=== modified file 'pybb/templates/pybb/inlines/display_category.html'
--- pybb/templates/pybb/inlines/display_category.html 2018-11-28 19:44:44 +0000
+++ pybb/templates/pybb/inlines/display_category.html 2019-02-27 20:07:53 +0000
@@ -12,35 +12,44 @@
<table class="forum">
{# List all forums #}
- {% for forum in category.forums.all %}
- <tr class="{% cycle 'odd' 'even' %}">
- <td class="forumIcon center">
- {% if forum|pybb_has_unreads:user %}
- <img src="{% static 'forum/img/folder_big_work_star.png' %}" style="width: 48px; height:48px; margin: 0px;" alt="" />
- {% else %}
- <img src="{% static 'forum/img/folder_big_work.png' %}" style="width: 48px; height:48px; margin: 0px;" alt="" />
- {% endif %}
- </td>
- <td class="forumTitle">
- <a href="{{ forum.get_absolute_url }}">{{ forum.name }}</a>
- <br />
- <span class="small">{{ forum.description }}</span>
- </td>
- <td class="forumCount center small" style="width: 120px;">
- Topics: {{ forum.topics.count }}<br/>
- Posts: {{ forum.posts.count }}
- </td>
- <td class="lastPost">
- {% if forum.last_post %}
- {% with last_post=forum.last_post %}
- <a href="{{last_post.get_absolute_url}}">{{ last_post.topic.name }}</a><br />
- <span class="small">by {{ last_post.user|user_link }}<br />
- on {{ last_post.created|custom_date:user}}</span>
- {% endwith %}
- {% else %}
-
- {% endif %}
- </td>
- </tr>
+ <thead>
+ <tr>
+ <th class="forumIcon"></th>
+ <th class="forumTitle small">Forum</th>
+ <th class="forumCount"></th>
+ <th class="lastPost small">Last Post on Topic</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for forum in category.forums.all %}
+ <tr class="{% cycle 'odd' 'even' %}">
+ <td class="forumIcon center">
+ {% if forum|pybb_has_unreads:user %}
+ <img src="{% static 'forum/img/folder_big_work_star.png' %}" style="width: 48px; height:48px; margin: 0px;" alt="" />
+ {% else %}
+ <img src="{% static 'forum/img/folder_big_work.png' %}" style="width: 48px; height:48px; margin: 0px;" alt="" />
+ {% endif %}
+ </td>
+ <td class="forumTitle">
+ <a href="{{ forum.get_absolute_url }}">{{ forum.name }}</a>
+ <br />
+ <span class="small">{{ forum.description }}</span>
+ </td>
+ <td class="forumCount center small" style="width: 120px;">
+ Topics: {{ forum.topics.count }}<br/>
+ Posts: {{ forum.posts.count }}
+ </td>
+ <td class="lastPost">
+ {% if forum.last_post %}
+ {% with last_post=forum.last_post %}
+ <a href="{{last_post.get_absolute_url}}">{{ last_post.topic.name|truncatechars:30 }}</a><br />
+ <span class="small">by {{ last_post.user|user_link }} on {{ last_post.created|custom_date:user}}</span>
+ {% endwith %}
+ {% else %}
+
+ {% endif %}
+ </td>
+ </tr>
{% endfor %}
+ </tbody>
</table>
=== modified file 'pybb/templates/pybb/inlines/post.html'
--- pybb/templates/pybb/inlines/post.html 2018-12-10 16:37:12 +0000
+++ pybb/templates/pybb/inlines/post.html 2019-02-27 20:07:53 +0000
@@ -3,115 +3,77 @@
{% endcomment %}
{% load i18n %}
-{% load humanize %}
{% load pybb_extras %}
-{% load wiki_extras %}
{% load wlprofile_extras %}
{% load custom_date %}
{% load static %}
- <a name="post-{{ post.id }}"></a>
- <table class="{% cycle "odd" "even" %}" width="100%">
- <tr>
- <td class="author">{{ post.user|user_link }}</td>
- <td width="85%" class="at">
- <table width="100%" cellpadding="0" cellspacing="0" style="table-layout: fixed; border: 0px;">
- <tr>
- <td style="text-align: left; border: 0px;">
- <a href="{{post.get_absolute_url}}">
- <img src="{% static 'forum/img/en/permalink.png' %}" height="25" alt ="{% trans "Permalink" %}" />
- </a>
- </td>
- <td style="text-align: right; border: 0px;">
- <strong>Posted at:</strong> {{ post.created|custom_date:user}}
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td class="userinfo">
- <div class="userinfo">
- {% if post.user.wlprofile.avatar %}
- <div class="avatar">
- <a href="{% url 'profile_view' post.user %}">
- <img src="{{ post.user.wlprofile.avatar.url }}" alt="Avatar" />
- </a>
- </div>
- {% endif %}
- <strong>Joined:</strong> {{ post.user.date_joined|custom_date:user|title }}<br />
- <strong>Posts:</strong> {{ post.user.wlprofile.post_count }}<br />
- <img src="{% static 'img/{{ post.user.wlprofile.user_status.image }}" alt="Ranking" />
- <br />
- <strong>{{ post.user.wlprofile.user_status.text }}</strong><br />
- {% if post.user.wlprofile.location %}
- <strong>Location:</strong> {{ post.user.wlprofile.location }}<br />
- {% endif %}
- </div>
- </td>
- <td width="85%" class="content top">
- {{ post.body_html|safe }}
- {% if user.is_authenticated %}
- {% ifequal user.wlprofile.show_signatures 1 %}
- {% if post.user.wlprofile.signature %}
- <div class="signature">
- <span class="line">__________________</span>
- {{ post.user.wlprofile.signature|urlize|linebreaks }}
- </div>
- {% endif %}
- {% endifequal %}
- {% else %}
- {% if post.user.wlprofile.signature %}
- <div class="signature">
- <span class="line">__________________</span>
- {{ post.user.wlprofile.signature|urlize|linebreaks }}
- </div>
- {% endif %}
- {% endif %}
- {% if post.updated %}
- <div class="updated-message"><strong>{% trans "Edited" %}:</strong> {{ post.updated|custom_date:user|title}}</div>
- {% endif %}
-
- {% if post.attachment_cache %}
- {% for attach in post.attachment_cache %}
- {% trans "Attachment" %}: <a href="{{ attach.get_absolute_url }}">{{ attach.name }}</a> ({{ attach.size_display }})
- {% endfor %}
- {% endif %}
- </td>
- </tr>
- <tr>
- <td class="toplink">
- <a href="#top">
- <img src="{% static 'forum/img/en/top.png' %}" height="25" alt ="{% trans "Top" %}" />
- </a>
- </td>
-
- <td>
- <div class="tools" style="float: left;">
- {% if user.is_authenticated %}
- {% ifnotequal user post.user %}
- <a href="{% url 'messages_compose_to' post.user %}">
- <img src="{% static 'forum/img/en/send_pm.png' %}" height="25" alt ="{% trans "Send PM" %}" />
- </a>
- {% endifnotequal %}
- {% endif %}
- {% if user_is_mod or post|pybb_posted_by:user %}
- <a href="{% url 'pybb_edit_post' post.id %}">
- <img src="{% static 'forum/img/en/edit.png' %}" height="25" alt ="{% trans "Edit" %}" />
- </a>
- {% endif %}
- {% if user_is_mod or post|pybb_equal_to:last_post %}
- {% if user_is_mod or post.user|pybb_equal_to:user %}
- <a href="{% url 'pybb_delete_post' post.id %}">
- <img src="{% static 'forum/img/en/delete.png' %}" height="25" alt ="{% trans "Delete" %}" />
- </a>
- {% endif %}
- </div>
- <div class="tools" style="float: right;">
- <a href="{% url 'pybb_add_post' topic.id %}?quote_id={{ post.id }}">
- <img src="{% static 'forum/img/en/quote.png' %}" height="25" alt ="{% trans "Quote" %}" />
- </a>
- {% endif %}
- </div>
- </td>
- </tr>
- </table>
+
+<td class="author">
+ {{ post.user|user_link }}<br />
+ {% if post.user.wlprofile.avatar %}
+ <a href="{% url 'profile_view' post.user %}">
+ <img src="{{ post.user.wlprofile.avatar.url }}" alt="Avatar" />
+ </a>
+ {% endif %}
+ <div class="authorStats">
+ <strong>Joined:</strong> {{ post.user.date_joined|custom_date:user|title }}<br />
+ <strong>Posts:</strong> {{ post.user.wlprofile.post_count }}<br />
+ <img src="{% static 'img/'%}{{ post.user.wlprofile.user_status.image }}" alt="Ranking" /><br />
+ <strong>{{ post.user.wlprofile.user_status.text }}</strong><br />
+ {% if post.user.wlprofile.location %}
+ <strong>Location:</strong> {{ post.user.wlprofile.location }}<br />
+ {% endif %}
+ </div>
+</td>
+<td class="post">
+ <a id="post-{{ post.id }}" href="{{post.get_absolute_url}}" title="{% trans "Permalink" %}" class="posRight small permalink"> </a>
+ <span class="small">Posted at: {{ post.created|custom_date:user}}</span>
+ <hr />
+ <div class="post">
+ {{ post.body_html|safe }}
+ </div>
+
+ {% if post.attachment_cache %}
+ {% for attach in post.attachment_cache %}
+ {% trans "Attachment" %}: <a href="{{ attach.get_absolute_url }}">{{ attach.name }}</a> ({{ attach.size_display }})
+ {% endfor %}
+ {% endif %}
+
+ {% if post.updated %}
+ <span class="small">{% trans "Edited" %}: {{ post.updated|custom_date:user|title}}</span>
+ {% endif %}
+ <hr />
+ {% if user.is_authenticated %}
+ {% ifequal user.wlprofile.show_signatures 1 %}
+ {% if post.user.wlprofile.signature %}
+ {{ post.user.wlprofile.signature|urlize|linebreaks }}
+ {% endif %}
+ {% endifequal %}
+ {% else %}
+ {% if post.user.wlprofile.signature %}
+ {{ post.user.wlprofile.signature|urlize|linebreaks }}
+ {% endif %}
+ {% endif %}
+
+ <a class="button posRight" href="#top">
+ <img src="{% static 'forum/img/top.png' %}" alt ="" class="middle" />
+ <span class="middle">{% trans "Top" %}</span>
+ </a>
+
+ <a class="button" href="{% url 'pybb_add_post' topic.id %}?quote_id={{ post.id }}">
+ <img src="{% static 'forum/img/quote.png' %}" alt ="" class="middle" />
+ <span class="middle">{% trans "Quote" %}</span>
+ </a>
+ {% if user_is_mod or post|pybb_posted_by:user %}
+ <a class="button" href="{% url 'pybb_edit_post' post.id %}">
+ <img src="{% static 'forum/img/edit.png' %}" alt ="" class="middle" />
+ <span class="middle">{% trans "Edit" %}</span>
+ </a>
+ {% if user_is_mod or post|pybb_equal_to:last_post %}
+ <a class="button" href="{% url 'pybb_delete_post' post.id %}">
+ <img src="{% static 'forum/img/delete.png' %}" alt ="" class="middle" />
+ <span class="middle">{% trans "Delete" %}</span>
+ </a>
+ {% endif %}
+ {% endif %}
+</td>
=== removed file 'pybb/templates/pybb/inlines/topic_row.html'
--- pybb/templates/pybb/inlines/topic_row.html 2018-11-22 11:08:51 +0000
+++ pybb/templates/pybb/inlines/topic_row.html 1970-01-01 00:00:00 +0000
@@ -1,43 +0,0 @@
-{% comment %}
- vim:ft=htmldjango:
-{% endcomment %}
-{% load humanize %}
-{% load pybb_extras %}
-{% load wlprofile_extras %}
-{% load custom_date %}
-{% load static %}
-
- <tr class="topic_description {% cycle "odd" "even" %}">
- <td align="center" valign="middle">
- {% if topic|pybb_has_unreads:user %}
- <img src="{% static 'forum/img/folder_new.png' %}" style="margin: 0px;" alt="" align="middle" />
- {% else %}
- <img src="{% static 'forum/img/folder.png' %}" style="margin: 0px;" alt="" align="middle" />
- {% endif %}
- </td>
- <td id="name">
- <span class="name">
- <a href="{{ topic.get_absolute_url }}">
- {% comment %}
- oehm ja, geht nicht weil ka muss ich guggn, die frage ist. soll es fuer alle gelten oder nur fuer eine topic
- {% endcomment %}
- {% if subscribed %}<img src="{% static 'forum/img/en/subscribe_small.png' %}" height="20" alt="subscribe" style="float:left" />{% endif %}
- {% if topic.sticky %}<img src="{% static 'forum/img/en/stick_topic_small.png' %}" height="20" alt ="Sticky" style="float:left;" /> {% endif %}
- {% if topic.closed %}<img src="{% static 'forum/img/en/close_small.png' %}" height="20" alt ="Closed" style="float:left; " /> {% endif %}
- {{ topic.name }}
- </a>
- </span>
- </td>
- <td><span class="creator">{{ topic.user|user_link }}</span></td>
- <td><span class="at">{{ topic.created|custom_date:user }}</span></td>
- <td><span class="count">{{ topic.post_count }}</span></td>
- <td><span class="views">{{ topic.views }}</span></td>
- <td>
- {%if topic.last_post %}
- {{ topic.last_post.created|custom_date:user }}
- <br />
- by {{ topic.last_post.user|user_link }}
- {% endif %}
- </td>
- </tr>
-
=== removed file 'pybb/templates/pybb/pagination.html'
--- pybb/templates/pybb/pagination.html 2010-09-29 00:00:45 +0000
+++ pybb/templates/pybb/pagination.html 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-{% load i18n %}
-<div class="pagination" style="float:left">
- <span class="summary">{{ label }} <strong>{{ page.start_index }}</strong>—<strong>{{ page.end_index }}</strong> {% trans "of" %} <strong>{{ paginator.count }}</strong> {{ label }} </span>
- {% if page.has_previous %}
- {% ifequal page.previous_page_number 1 %}
- <a href="?page={{ page.previous_page_number }}" class="prev">‹‹ </a>
- {% else %}
- <a href="?page=1" class="prev">‹‹‹‹ </a>
- <a href="?page={{ page.previous_page_number }}" class="prev">‹‹ </a>
- {% endifequal %}
- {% else %}
- {% ifnotequal paginator.num_pages 1 %}
- <span class="disabled prev">‹‹ </span>
- {% endifnotequal %}
- {% endif %}
- {% for pages in paginator.page_range %}
- {% if pages %}
- {% ifequal paginator.num_pages 1 %}
- ...
- {% else %}
- {% ifequal pages page.number %}
- <span class="current page">| {{ page.number }} |</span>
- {% else %}
- <a href="?page={{ pages }}" class="page">{{ pages }}</a>
- {% endifequal %}
- {% endifequal %}
- {% endif %}
- {% endfor %}
- {% if page.has_next %}
- {% ifequal page.next_page_number paginator.num_pages %}
- <a href="?page={{ page.next_page_number }}" class="next"> ››</a>
- {% else %}
- <a href="?page={{ page.next_page_number }}" class="next"> ››</a>
- <a href="?page={{ paginator.num_pages }}" class="next"> ››››</a>
- {% endifequal %}
- {% else %}
- {% ifnotequal paginator.num_pages 1 %}
- <span class="disabled next"> ››</span>
- {% endifnotequal %}
- {% endif %}
-</div>
=== modified file 'pybb/templates/pybb/topic.html'
--- pybb/templates/pybb/topic.html 2018-12-10 16:37:12 +0000
+++ pybb/templates/pybb/topic.html 2019-02-27 20:07:53 +0000
@@ -1,8 +1,6 @@
{% extends 'pybb/base.html' %}
{% load pybb_extras %}
{% load i18n %}
-{% load humanize %}
-{% load wiki_extras %}
{% load wlprofile_extras %}
{% load custom_date %}
{% load pagination_tags %}
@@ -19,7 +17,7 @@
{% endblock %}
{% block content_header %}
- <h1>Topic: {{ topic }} </h1>
+ <h1>Topic: {{ topic }} first_post: {{ first_post }}, {{ posts.0 }}</h1>
{% endblock %}
{% block content_main %}
@@ -93,177 +91,21 @@
</div>
{% autopaginate posts page_size as object_list %}
{% paginate using "pagination/pagination_mod.html" %}
-
- {% if first_post %}
- {% ifnotequal first_post posts.0 %}
- {% with first_post as post %}
- {% trans "First Post" %}:
- <table class="forum">
- <tbody>
- <tr class="odd">
- <td class="author">
- {{ post.user|user_link }}<br />
- {% if post.user.wlprofile_extras.avatar %}
- <a href="{% url 'profile_view' post.user %}">
- <img src="{{ post.user.wlprofile.avatar.url }}" alt="Avatar" />
- </a>
- {% endif %}
- <div class="authorStats">
- <strong>Joined:</strong> {{ post.user.date_joined|custom_date:user|title }}<br />
- <strong>Posts:</strong> {{ post.user.wlprofile.post_count }}<br />
- <img src="{% static 'img/' %}{{ post.user.wlprofile.user_status.image }}" alt="Ranking" /><br />
- <strong>{{ post.user.wlprofile.user_status.text }}</strong><br />
- {% if post.user.wlprofile.location %}
- <strong>Location:</strong> {{ post.user.wlprofile.location }}<br />
- {% endif %}
- </div>
- </td>
- <td class="post">
- <a id="post-{{ post.id }}" href="{{post.get_absolute_url}}" title="{% trans "Permalink" %}" class="posRight small permalink"> </a>
- <span class="small">Posted at: {{ post.created|custom_date:user}}</span>
- <hr />
- <div class="post">
- {{ post.body_html|safe }}
- </div>
-
- {% if post.attachment_cache %}
- {% for attach in post.attachment_cache %}
- {% trans "Attachment" %}: <a href="{{ attach.get_absolute_url }}">{{ attach.name }}</a> ({{ attach.size_display }})
- {% endfor %}
- {% endif %}
-
- {% if post.updated %}
- <span class="small">{% trans "Edited" %}: {{ post.updated|custom_date:user|title}}</span>
- {% endif %}
- <hr />
- {% if user.is_authenticated %}
- {% ifequal user.wlprofile.show_signatures 1 %}
- {% if post.user.wlprofile.signature %}
- {{ post.user.wlprofile.signature|urlize|linebreaks }}
- {% endif %}
- {% endifequal %}
- {% else %}
- {% if post.user.wlprofile.signature %}
- {{ post.user.wlprofile.signature|urlize|linebreaks }}
- {% endif %}
- {% endif %}
-
- <button onclick="window.location.href='#top';" class="posRight">
- <img src="{% static 'forum/img/top.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Top" %}</span>
- </button>
-
- <button onclick="window.location.href='{% url 'pybb_add_post' topic.id %}?quote_id={{ post.id }}';">
- <img src="{% static 'forum/img/quote.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Quote" %}</span>
- </button>
- {% if user_is_mod or post|pybb_posted_by:user %}
- <button onclick="window.location.href='{% url 'pybb_edit_post' post.id %}';">
- <img src="{% static 'forum/img/edit.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Edit" %}</span>
- </button>
- {% if user_is_mod or post|pybb_equal_to:last_post %}
- <button onclick="window.location.href='{% url 'pybb_delete_post' post.id %}';">
- <img src="{% static 'forum/img/delete.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Delete" %}</span>
- </button>
- {% endif %}
- {% endif %}
- </td>
- </tr>
- </tbody>
- </table>
- <br /><hr /><br />
- {% endwith %}
- {% endifnotequal %}
- {% endif %}
-
- <table class="forum">
- <tbody>
- {% for post in object_list %}
- {% comment %}
- TODO (Franku): use
- {% include 'pybb/inlines/post.html' %}
- {% endcomment %}
- <tr class="{% cycle 'odd' 'even' %}" {% if post.is_spam %} style="background-color: gray" {% endif %}>
- <td class="author">
- {{ post.user|user_link }}<br />
- {% if post.user.wlprofile.avatar %}
- <a href="{% url 'profile_view' post.user %}">
- <img src="{{ post.user.wlprofile.avatar.url }}" alt="Avatar" />
- </a>
- {% endif %}
- <div class="authorStats">
- <strong>Joined:</strong> {{ post.user.date_joined|custom_date:user|title }}<br />
- <strong>Posts:</strong> {{ post.user.wlprofile.post_count }}<br />
- <img src="{% static 'img/'%}{{ post.user.wlprofile.user_status.image }}" alt="Ranking" /><br />
- <strong>{{ post.user.wlprofile.user_status.text }}</strong><br />
- {% if post.user.wlprofile.location %}
- <strong>Location:</strong> {{ post.user.wlprofile.location }}<br />
- {% endif %}
- </div>
- </td>
- <td class="post">
- <a id="post-{{ post.id }}" href="{{post.get_absolute_url}}" title="{% trans "Permalink" %}" class="posRight small permalink"> </a>
- <span class="small">Posted at: {{ post.created|custom_date:user}}</span>
- <hr />
- <div class="post">
- {{ post.body_html|safe }}
- </div>
-
- {% if post.attachment_cache %}
- {% for attach in post.attachment_cache %}
- {% trans "Attachment" %}: <a href="{{ attach.get_absolute_url }}">{{ attach.name }}</a> ({{ attach.size_display }})
- {% endfor %}
- {% endif %}
-
- {% if post.updated %}
- <span class="small">{% trans "Edited" %}: {{ post.updated|custom_date:user|title}}</span>
- {% endif %}
- <hr />
- {% if user.is_authenticated %}
- {% ifequal user.wlprofile.show_signatures 1 %}
- {% if post.user.wlprofile.signature %}
- {{ post.user.wlprofile.signature|urlize|linebreaks }}
- {% endif %}
- {% endifequal %}
- {% else %}
- {% if post.user.wlprofile.signature %}
- {{ post.user.wlprofile.signature|urlize|linebreaks }}
- {% endif %}
- {% endif %}
-
- <a class="button posRight" href="#top">
- <img src="{% static 'forum/img/top.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Top" %}</span>
- </a>
-
- <a class="button" href="{% url 'pybb_add_post' topic.id %}?quote_id={{ post.id }}">
- <img src="{% static 'forum/img/quote.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Quote" %}</span>
- </a>
- {% if user_is_mod or post|pybb_posted_by:user %}
- <a class="button" href="{% url 'pybb_edit_post' post.id %}">
- <img src="{% static 'forum/img/edit.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Edit" %}</span>
- </a>
- {% if user_is_mod or post|pybb_equal_to:last_post %}
- <a class="button" href="{% url 'pybb_delete_post' post.id %}">
- <img src="{% static 'forum/img/delete.png' %}" alt ="" class="middle" />
- <span class="middle">{% trans "Delete" %}</span>
- </a>
- {% endif %}
- {% endif %}
- </td>
- </tr>
- {% if not forloop.last %}
- {# no spacer at end of table #}
- <tr class="spacer">
- <td></td>
- <td></td>
- </tr>
- {% endif %}
- {% endfor %}
+
+ <table class="forum">
+ <tbody>
+ {% for post in object_list %}
+ <tr class="{% cycle 'odd' 'even' %}" {% if post.is_spam %} style="background-color: gray" {% endif %}>
+ {% include 'pybb/inlines/post.html' %}
+ </tr>
+ {% if not forloop.last %}
+ {# no spacer at end of table #}
+ <tr class="spacer">
+ <td></td>
+ <td></td>
+ </tr>
+ {% endif %}
+ {% endfor %}
</tbody>
</table>
=== modified file 'pybb/templatetags/pybb_extras.py'
--- pybb/templatetags/pybb_extras.py 2018-12-18 11:38:34 +0000
+++ pybb/templatetags/pybb_extras.py 2019-02-27 20:07:53 +0000
@@ -9,10 +9,8 @@
from django.template.defaultfilters import stringfilter
from django.utils.encoding import smart_unicode
from django.utils.html import escape
-from django.utils.translation import ugettext as _
-from django.utils import dateformat
-from pybb.models import Post, Forum, Topic, Read, Category
+from pybb.models import Post, Forum, Topic, Read
from pybb.unread import cache_unreads
from pybb import settings as pybb_settings
import pybb.views
@@ -20,66 +18,6 @@
register = template.Library()
-@register.tag
-def pybb_time(parser, token):
- try:
- tag, time = token.split_contents()
- except ValueError:
- raise template.TemplateSyntaxError(
- 'pybb_time requires single argument')
- else:
- return PybbTimeNode(time)
-
-
-class PybbTimeNode(template.Node):
-
- def __init__(self, time):
- self.time = template.Variable(time)
-
- def render(self, context):
- time = self.time.resolve(context)
-
- delta = datetime.now() - time
- today = datetime.now().replace(hour=0, minute=0, second=0)
- yesterday = today - timedelta(days=1)
-
- if delta.days == 0:
- if delta.seconds < 60:
- if context['LANGUAGE_CODE'].startswith('ru'):
- msg = _('seconds ago,seconds ago,seconds ago')
- import pytils
- msg = pytils.numeral.choose_plural(delta.seconds, msg)
- else:
- msg = _('seconds ago')
- return u'%d %s' % (delta.seconds, msg)
-
- elif delta.seconds < 3600:
- minutes = int(delta.seconds / 60)
- if context['LANGUAGE_CODE'].startswith('ru'):
- msg = _('minutes ago,minutes ago,minutes ago')
- import pytils
- msg = pytils.numeral.choose_plural(minutes, msg)
- else:
- msg = _('minutes ago')
- return u'%d %s' % (minutes, msg)
- if time > today:
- return _('today, %s') % time.strftime('%H:%M')
- elif time > yesterday:
- return _('yesterday, %s') % time.strftime('%H:%M')
- else:
- return dateformat.format(time, 'd M, Y H:i')
-
-
-@register.inclusion_tag('pybb/pagination.html', takes_context=True)
-def pybb_pagination(context, label):
- page = context['page']
- paginator = context['paginator']
- return {'page': page,
- 'paginator': paginator,
- 'label': label,
- }
-
-
@register.inclusion_tag('pybb/last_posts.html', takes_context=True)
def pybb_last_posts(context, number=8):
if pybb.views.allowed_for(context.request.user):
@@ -225,39 +163,6 @@
return pprint(post)
-@register.simple_tag
-def pybb_render_post(post, mode='html'):
- """Process post contents and replace special tags with human readeable
- messages.
-
- Arguments:
- post - the ``Post`` instance
- mode - "html" or "text". Control which field to use ``body_html`` or ``body_text``
-
- Currently following tags are supported:
-
- @@@AUTOJOIN-(SECONDS)@@@ - autojoin message
-
- """
-
- def render_autojoin_message(match):
- time_diff = int(match.group(1)) / 60
-
- join_message = ungettext(u"Added after %s minute",
- u"Added after %s minutes",
- time_diff)
- join_message %= time_diff
-
- if mode == 'html':
- return u'<div class="autojoin-message">%s</div>' % join_message
- else:
- return join_message
-
- body = getattr(post, 'body_%s' % mode)
- re_tag = re.compile(r'@@@AUTOJOIN-(\d+)@@@')
- return re_tag.sub(render_autojoin_message, body)
-
-
@register.inclusion_tag('mainpage/forum_navigation.html', takes_context=True)
def forum_navigation(context):
"""Makes the forum list available to the navigation.
@@ -268,81 +173,12 @@
"""
- from pybb.models import Forum
-
forums = Forum.objects.all()
-
- if context.request.user.is_superuser or pybb.views.allowed_for(context.request.user):
+
+ if pybb.views.allowed_for(context.request.user):
pass
else:
# Don't show internal forums
forums = forums.filter(category__internal=False)
return {'forums': forums.order_by('category', 'position')}
-
-
-"""
-Spielwiese, Playground, Cour de récréati ;)
-"""
-
-
-@register.filter
-@stringfilter
-def pybb_trim_string(value, arg):
- """
- Mit "arg" ist es moeglich 1 oder mehr Werte der Funtion zu Uebergeben. Wenn
- mehr als 1 Wert genutzt werden soll wird es durch "-" getrennt. Jeder Wert
- kann entweder die Beschraenkung fuer die Zeichen oder Woerter beinhalten.
- Um das eindeutig zu identifizieren Wort "w" und Zeichen "z".
- Beispiel:
- 1. w:10 -> Auf 10 Worte beschraenken
- 2. z:250 -> Auf 250 Zeichen beschraenken
- 3. w:10-z:250 -> Auf 10 Worte und 250 Zeichen beschraenken
-
- Beim spaeteren drueber nachdenken ist das mit den Worten eig. egal und
- koennte wieder entfernt werden, aber vllt findet ja einer noch einen nutzen
- dafuer ;)
- """
- _iWord = ''
- _iSign = ''
- _lArguments = arg.split('-')
- _sOption = _lArguments[0].split(':')[0]
- _iValue = _lArguments[0].split(':')[1]
- if len(_lArguments) == 1:
- if _sOption == 'w':
- _iWord = int(_iValue)
- elif _sOption == 'z':
- _iSign = int(_iValue)
- else:
- pass
- elif len(_lArguments) == 2:
- if _sOption == 'w':
- _iWord = int(_iValue)
- _iSign = int(_lArguments[1].split(':')[1])
- elif _sOption == 'z':
- _iSign = int(_iValue)
- _iWord = int(_lArguments[1].split(':')[1])
- else:
- pass
- else:
- pass
- if _iWord != '' or _iSign != '':
- _iWordCount = int(len(value.split(' ')))
- _iSignCount = int(len(value))
- """
- Hier waere noch die Ueberlegung wenn 2 Werte gesetzt das man dann
- wirklich nur ganze Woerter anzeigen laesst ohne sie zu beschneiden
- """
- if _iWord != '' and _iSign != '' and _iSignCount >= _iSign:
- return value[0:_iSign] + '...'
- elif _iWord != '' and _iSign == '' and _iWordCount >= _iWord:
- return ' '.join(value.split(' ')[0:_iWord]) + '...'
- elif _iWord == '' and _iSign != '' and _iSignCount >= _iSign:
- return value[0:_iSign] + '...'
- else:
- return value
- # return " " + str(len(value)) + " " + str(len(value.split(" "))) +
- # " " + str(arg) + " " + str(_iWord) + ":" + str(_iWordCount) + " "
- # + str(_iSign) + ":" + str(_iSignCount)
- else:
- return value
=== modified file 'pybb/urls.py'
--- pybb/urls.py 2018-11-15 18:30:45 +0000
+++ pybb/urls.py 2019-02-27 20:07:53 +0000
@@ -40,7 +40,6 @@
url('^post/(?P<post_id>\d+)/edit/$', views.edit_post, name='pybb_edit_post'),
url('^post/(?P<post_id>\d+)/delete/$',
views.delete_post, name='pybb_delete_post'),
- url('pybb_moderate_info/$', views.pybb_moderate_info),
# Attachment
url('^attachment/(?P<hash>\w+)/$',
=== modified file 'pybb/util.py'
--- pybb/util.py 2018-11-09 17:46:16 +0000
+++ pybb/util.py 2019-02-27 20:07:53 +0000
@@ -48,48 +48,6 @@
return decorator
-def paged(paged_list_name, per_page): # , per_page_var='per_page'):
- """Parse page from GET data and pass it to view.
-
- Split the query set returned from view.
-
- """
-
- def decorator(func):
- def wrapper(request, *args, **kwargs):
- result = func(request, *args, **kwargs)
- if not isinstance(result, dict):
- return result
- try:
- page = int(request.GET.get('page', 1))
- except ValueError:
- page = 1
-
- real_per_page = per_page
-
- # if per_page_var:
- # try:
- #value = int(request.GET[per_page_var])
- # except (ValueError, KeyError):
- # pass
- # else:
- # if value > 0:
- #real_per_page = value
-
- from django.core.paginator import Paginator
- paginator = Paginator(result['paged_qs'], real_per_page)
- result[paged_list_name] = paginator.page(page).object_list
- result['page'] = page
- result['page_list'] = range(1, paginator.num_pages + 1)
- result['pages'] = paginator.num_pages
- result['per_page'] = real_per_page
- result['request'] = request
- return result
- return wrapper
-
- return decorator
-
-
def ajax(func):
"""Checks request.method is POST. Return error in JSON in other case.
@@ -206,27 +164,6 @@
return text
-def absolute_url(path):
- return 'http://%s%s' % (pybb_settings.HOST, path)
-
-
-def memoize_method(func):
- """Cached result of function call."""
-
- def wrapper(self, *args, **kwargs):
- CACHE_NAME = '__memcache'
- try:
- cache = getattr(self, CACHE_NAME)
- except AttributeError:
- cache = {}
- setattr(self, CACHE_NAME, cache)
- key = (func, tuple(args), frozenset(kwargs.items()))
- if key not in cache:
- cache[key] = func(self, *args, **kwargs)
- return cache[key]
- return wrapper
-
-
def unescape(text):
"""Do reverse escaping."""
=== modified file 'pybb/views.py'
--- pybb/views.py 2018-12-18 11:38:34 +0000
+++ pybb/views.py 2019-02-27 20:07:53 +0000
@@ -3,21 +3,18 @@
from pybb.markups import mypostmarkup
from django.shortcuts import get_object_or_404
-from django.http import HttpResponseRedirect, HttpResponse, HttpResponseNotFound, Http404
+from django.http import HttpResponseRedirect, HttpResponse, Http404
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
-from django.conf import settings
from django.urls import reverse
-from django.db import connection
-from django.utils import translation
-from django.shortcuts import render, redirect
+from django.shortcuts import redirect
from django.db.models import Q
from django.http import Http404
-from pybb.util import render_to, paged, build_form, quote_text, ajax, urlize
-from pybb.models import Category, Forum, Topic, Post, PrivateMessage, Attachment,\
+from pybb.util import render_to, build_form, quote_text, ajax, urlize
+from pybb.models import Category, Forum, Topic, Post, Attachment,\
MARKUP_CHOICES
-from pybb.forms import AddPostForm, EditPostForm, UserSearchForm
+from pybb.forms import AddPostForm, EditPostForm
from pybb import settings as pybb_settings
from pybb.orm import load_related
from pybb.templatetags.pybb_extras import pybb_moderated_by
@@ -33,7 +30,7 @@
def allowed_for(user):
"""Check if a user has the permission to enter internal Forums."""
- return user.is_superuser or user.has_perm(settings.INTERNAL_PERM)
+ return user.is_superuser or user.has_perm(pybb_settings.INTERNAL_PERM)
def index_ctx(request):
@@ -91,10 +88,6 @@
if request.user.is_authenticated:
topic.update_read(request.user)
- if pybb_settings.FREEZE_FIRST_POST:
- first_post = topic.posts.order_by('created')[0]
- else:
- first_post = None
last_post = topic.posts.order_by('-created')[0]
initial = {}
@@ -127,7 +120,6 @@
return {'topic': topic,
'last_post': last_post,
- 'first_post': first_post,
'form': form,
'user_is_mod': user_is_mod,
'subscribed': subscribed,
@@ -191,8 +183,8 @@
# - enable 'forum_new_topic' in the notification settings, or
# - subscribe to an existing topic
subscribers = User.objects.filter(
- Q(groups__permissions__codename=settings.INTERNAL_PERM) |
- Q(user_permissions__codename=settings.INTERNAL_PERM)
+ Q(groups__permissions__codename=pybb_settings.INTERNAL_PERM) |
+ Q(user_permissions__codename=pybb_settings.INTERNAL_PERM)
).exclude(username=request.user.username)
superusers = User.objects.filter(
is_superuser=True).exclude(
@@ -233,15 +225,6 @@
add_post = render_to('pybb/add_post.html')(add_post_ctx)
-def user_ctx(request, username):
- user = get_object_or_404(User, username=username)
- topic_count = Topic.objects.filter(user=user).count()
- return {'profile': user,
- 'topic_count': topic_count,
- }
-user = render_to('pybb/user.html')(user_ctx)
-
-
def show_post(request, post_id):
post = get_object_or_404(Post, pk=post_id)
count = post.topic.posts.filter(created__lt=post.created).count() + 1
@@ -349,22 +332,6 @@
return HttpResponseRedirect(topic.get_absolute_url())
-@render_to('pybb/users.html')
-def users_ctx(request):
- users = User.objects.order_by('username')
- form = UserSearchForm(request.GET)
- users = form.filter(users)
-
- page, paginator = paginate(users, request, pybb_settings.USERS_PAGE_SIZE)
-
- return {'users': page.object_list,
- 'page': page,
- 'paginator': paginator,
- 'form': form,
- }
-users = render_to('pybb/users.html')(users_ctx)
-
-
@login_required
def delete_subscription(request, topic_id):
topic = get_object_or_404(Topic, pk=topic_id)
@@ -410,10 +377,6 @@
return {'content': html}
-def pybb_moderate_info(request):
- return render(request, 'pybb/pybb_moderate_info.html')
-
-
def toggle_hidden_topic(request, topic_id):
topic = get_object_or_404(Topic, pk=topic_id)
first_post = topic.posts.all()[0]
=== modified file 'settings.py'
--- settings.py 2019-02-09 14:41:20 +0000
+++ settings.py 2019-02-27 20:07:53 +0000
@@ -190,9 +190,9 @@
######################
# Pybb Configuration #
######################
+# See also pybb defaults in pybb.settings.py
PYBB_ATTACHMENT_ENABLE = False # disable gzip middleware when enabling attachments
PYBB_DEFAULT_MARKUP = 'markdown'
-PYBB_FREEZE_FIRST_POST = False
INTERNAL_PERM='pybb.can_access_internal' # The permission string derived from pybb.models.category
##############################################
=== modified file 'wlprofile/models.py'
--- wlprofile/models.py 2018-09-13 20:19:07 +0000
+++ wlprofile/models.py 2019-02-27 20:07:53 +0000
@@ -54,9 +54,6 @@
verbose_name = _('Profile')
verbose_name_plural = _('Profiles')
- def unread_pm_count(self):
- return PrivateMessage.objects.filter(dst_user=self, read=False).count()
-
def post_count(self):
"""Return the nr of posts the user has.
Follow ups
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: kaputtnik, 2019-03-04
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: kaputtnik, 2019-03-04
-
[Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: noreply, 2019-03-04
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: kaputtnik, 2019-03-04
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: GunChleoc, 2019-03-04
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: kaputtnik, 2019-03-03
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: kaputtnik, 2019-03-02
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: GunChleoc, 2019-03-02
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: kaputtnik, 2019-02-28
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: GunChleoc, 2019-02-28
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: kaputtnik, 2019-02-28
-
Re: [Merge] lp:~widelands-dev/widelands-website/pybb_cleanup into lp:widelands-website
From: GunChleoc, 2019-02-28