def favorite_all(request, organization_slug): organization = get_object_or_404(Organization, slug=organization_slug) for project in organization.projects.all(): if project.active and access.has_read_access(project, request.user): Favorite.setFavorite(1, project.id, request.user, True) return HttpResponseRedirect( reverse("organization_detail", kwargs={"organization_slug": organization_slug}))
def news_feed(context): user = context["user"] request = context["request"] if "organization" in context: organization = context["organization"] if organization.hasStaffAccess(user): # The user can see app projects in the org. news_items = NewsItem.objects.filter(project__organization=organization) else: # NOTE: We need to watch this query to make sure it performs ok. news_items = NewsItem.objects.filter(project__organization=organization, project__teams__members=user).distinct() else: project = context["project"] if access.has_read_access(project,user): news_items = NewsItem.objects.filter(project=project) else: news_items = [] return {'newsitems':news_items,"request":request}
def news_feed(context): user = context["user"] request = context["request"] if "organization" in context: organization = context["organization"] if organization.hasStaffAccess(user): # The user can see app projects in the org. news_items = NewsItem.objects.filter( project__organization=organization) else: # NOTE: We need to watch this query to make sure it performs ok. news_items = NewsItem.objects.filter( project__organization=organization, project__teams__members=user).distinct() else: project = context["project"] if access.has_read_access(project, user): news_items = NewsItem.objects.filter(project=project) else: news_items = [] return {'newsitems': news_items, "request": request}
def render(self, context): if has_read_access(context[self.project], context["request"].user): output = self.nodelist.render(context) return output else: return ""
def favorite_all(request, organization_slug): organization = get_object_or_404(Organization, slug=organization_slug) for project in organization.projects.all(): if project.active and access.has_read_access(project, request.user): Favorite.setFavorite(1, project.id, request.user, True) return HttpResponseRedirect(reverse("organization_detail", kwargs={"organization_slug": organization_slug}))