My favorites
▼
|
Sign in
django-forum
Simple Django Forum Component
Project Home
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
74
attachment: managers.py
(445 bytes)
1
2
3
4
5
6
7
8
9
10
11
12
13
from django.db import models
from django.db.models import Q
class ForumManager(models.Manager):
def for_groups(self, groups):
if groups:
public = Q(groups__isnull=True)
user_groups = Q(groups__in=groups)
return self.filter(public|user_groups).distinct()
return self.filter(groups__isnull=True)
def has_access(self, forum, groups):
return forum in self.for_groups(groups)
Powered by
Google Project Hosting