~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to pybb/feeds.py

  • Committer: franku
  • Date: 2018-09-19 18:30:17 UTC
  • mfrom: (497.2.17 delete_user)
  • Revision ID: somal@arcor.de-20180919183017-0mhtkxmycgn3b4lz
make it possible for a user to delete himself, anonymize his data

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
from django.core.exceptions import ObjectDoesNotExist
4
4
from django.utils.feedgenerator import Atom1Feed
5
5
from pybb.models import Post, Topic, Forum
 
6
from django.conf import settings
6
7
 
7
8
 
8
9
class PybbFeed(Feed):
60
61
    def items_for_object(self, obj):
61
62
        return Post.objects.filter(hidden=False, topic__forum=obj).order_by('-created')[:15]
62
63
 
63
 
    def item_author_name(self, item):
64
 
        """Takes the object returned by get_object and returns the feeds's
65
 
        auhor's name as a Python string."""
66
 
        return item.user.username
67
 
 
68
64
# Validated through http://validator.w3.org/feed/
69
65
 
70
66
 
78
74
 
79
75
    def items_for_object(self, item):
80
76
        return Topic.objects.exclude(posts__hidden=True).filter(forum=item).order_by('-created')[:15]
81
 
 
82
 
    def item_author_name(self, item):
83
 
        """Takes the object returned by get_object and returns the feeds's
84
 
        auhor's name as a Python string."""
85
 
        return item.user.username