← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands-website/official_posts into lp:widelands-website

 

Review: Approve

Just 2 more string nits. Deploy any time :)

Diff comments:

> 
> === modified file 'pybb/models.py'
> --- pybb/models.py	2018-12-21 09:43:02 +0000
> +++ pybb/models.py	2019-03-23 09:01:09 +0000
> @@ -255,6 +255,31 @@
>          except:
>              return []
>  
> +class PublicPostsManager(models.Manager):
> +
> +    def public(self, limit=None, date_from=None):
> +        """Get public posts.
> +
> +        That are all posts which shouldn't be visible to normal

"Filters out all posts..." or some such? This sounds to me as if only internal/hidden posts were returned, while we are doing the opposite

> +        visitors. The result is always orderd by the posts
> +        creation time, Descending. Optional arguments:
> +
> +        limit:     Slice the QuerySet [:limit].
> +        date_from: Gathers all posts from this day until today.
> +        """
> +
> +        qs = self.get_queryset().filter(
> +            topic__forum__category__internal=False, hidden=False).exclude(
> +            topic__in=Post.hidden_topics.all()).order_by(
> +            '-created')
> +        
> +        if date_from:
> +            qs = qs.filter(created__gte=date_from)
> +        if limit:
> +            qs = qs[:limit]
> +
> +        return qs
> +
>  
>  class Post(RenderableItem):
>      topic = models.ForeignKey(
> @@ -270,8 +295,8 @@
>      body_text = models.TextField(_('Text version'))
>      hidden = models.BooleanField(_('Hidden'), blank=True, default=False)
>  
> -    objects = models.Manager() # Normal manager 
> -    hidden_topics = HiddenTopicsManager() # Custom manager
> +    objects = PublicPostsManager()  # Normal manager, extendet

extendet -> extended

> +    hidden_topics = HiddenTopicsManager()  # Custom manager
>  
>      class Meta:
>          ordering = ['created']


-- 
https://code.launchpad.net/~widelands-dev/widelands-website/official_posts/+merge/364989
Your team Widelands Developers is subscribed to branch lp:widelands-website.


References