Exemplo n.º 1
0
def project_wall(request, project, discussion_area=False):
    is_organizing = project.is_organizing(request.user)
    is_participating = project.is_participating(request.user)
    if is_organizing:
        form = statuses_forms.ImportantStatusForm()
    elif is_participating:
        form = statuses_forms.StatusForm()
    else:
        form = None

    activities = project.activities()
    if discussion_area:
        activities = apply_filter(activities, "messages")
    else:
        activities = filter_activities(request, activities)

    if project.category == Project.CHALLENGE:
        url = reverse("projects_discussion_area", kwargs=dict(slug=project.slug))
    else:
        url = project.get_absolute_url()

    context = {
        "request": request,
        "user": request.user,
        "project": project,
        "participating": is_participating,
        "organizing": is_organizing,
        "form": form,
        "discussion_area": discussion_area,
        "domain": Site.objects.get_current().domain,
        "wall_url": url,
    }
    context.update(get_pagination_context(request, activities))
    return context
Exemplo n.º 2
0
def project_wall(request, project, discussion_area=False):
    is_organizing = project.is_organizing(request.user)
    is_participating = project.is_participating(request.user)
    if is_organizing:
        form = statuses_forms.ImportantStatusForm()
    elif is_participating:
        form = statuses_forms.StatusForm()
    else:
        form = None

    activities = project.activities()
    if discussion_area:
        activities = apply_filter(activities, 'messages')
    else:
        activities = filter_activities(request, activities)

    if project.category == Project.CHALLENGE:
        url = reverse('projects_discussion_area',
            kwargs=dict(slug=project.slug))
    else:
        url = project.get_absolute_url()

    context = {
        'request': request,
        'user': request.user,
        'project': project,
        'participating': is_participating,
        'organizing': is_organizing,
        'form': form,
        'discussion_area': discussion_area,
        'domain': Site.objects.get_current().domain,
        'wall_url': url,
    }
    context.update(get_pagination_context(request, activities))
    return context
Exemplo n.º 3
0
def project_wall(request, project, discussion_area=False):
    is_organizing = project.is_organizing(request.user)
    is_participating = project.is_participating(request.user)
    if is_organizing:
        form = statuses_forms.ImportantStatusForm()
    elif is_participating:
        form = statuses_forms.StatusForm()
    else:
        form = None

    activities = project.activities()
    if discussion_area:
        activities = apply_filter(activities, 'messages')
    else:
        activities = filter_activities(request, activities)

    if project.category == Project.CHALLENGE:
        url = reverse('projects_discussion_area',
            kwargs=dict(slug=project.slug))
    else:
        url = project.get_absolute_url()

    context = {
        'request': request,
        'user': request.user,
        'project': project,
        'participating': is_participating,
        'organizing': is_organizing,
        'form': form,
        'discussion_area': discussion_area,
        'domain': Site.objects.get_current().domain,
        'wall_url': url,
    }
    context.update(get_pagination_context(request, activities))
    return context
Exemplo n.º 4
0
def filter_activities(request, activities, default=None):
    if 'activities_filter' in request.GET:
        filter_name = request.GET['activities_filter']
        return apply_filter(activities, filter_name)
    return apply_filter(activities, 'default')