Beispiel #1
0
def show_person(request, permalink):
    person = get_object_or_404(Person, permalink=permalink)

    form = WallForm(request.POST or None)
    if request.POST and request.user.is_authenticated() and form.is_valid():
        sr = ShortReview.objects.create(
                kind=ShortReview.WALLPOST,
                user=request.user,
                object=person,
                review_text=form.cleaned_data['text'],
                type=ShortReview.TYPE_SHORT_REVIEW,
        )
	messages.add_message(request, messages.INFO, gettext('Wall post has been published'))
	form = WallForm()
    
    activities = UserActivity.objects.wall_filter(request).filter(person=person)
    activities = ajax_activity_pager(request, activities)
    
    context = {
        'person':person,
        'form':form,
        'activities':activities,
    }
    return render(
        request,
        ajax_select_template(request, 'person/person.html'),
        context
    )
Beispiel #2
0
def show_person(request, permalink):
    person = get_object_or_404(Person, permalink=permalink)

    form = WallForm(request.POST or None)
    if request.POST and request.user.is_authenticated() and form.is_valid():
        sr = ShortReview.objects.create(
            kind=ShortReview.WALLPOST,
            user=request.user,
            object=person,
            review_text=form.cleaned_data['text'],
            type=ShortReview.TYPE_SHORT_REVIEW,
        )
        messages.add_message(request, messages.INFO,
                             gettext('Wall post has been published'))
        form = WallForm()

    activities = UserActivity.objects.wall_filter(request).filter(
        person=person)
    activities = ajax_activity_pager(request, activities)

    context = {
        'person': person,
        'form': form,
        'activities': activities,
    }
    return render(request, ajax_select_template(request, 'person/person.html'),
                  context)
Beispiel #3
0
def _public_profile(request, username, activity_option):
    """
        Show public user profile
    """
    try:
        user = User.objects.get(username__iexact=username)
    except User.DoesNotExist:
        raise Http404

    if activity_option == 'user_all':
        activities = UserActivity.objects.all_for_user(user)
    else:
        activities = UserActivity.objects.public()

    activities = ajax_activity_pager(request, activities)
    
    data = {
        'activities': activities,
        'user_profile': user,
    }

    return render(
        request,
        ajax_select_template(request, templates['PROFILE']),
        data
    )
Beispiel #4
0
def _show_dashboard(request):
    """
        Show dashboard for logged in user
    """
    from film20.useractivity.useractivity_helper import ajax_activity_pager, \
        ajax_select_template

    filter = None
    user = request.user
    profile = user.get_profile()

    # handle wall post form
    if request.method == "POST":
        form = WallForm(request.POST)
        if form.is_valid():
            sr = ShortReview(kind=ShortReview.WALLPOST,
                             user=user,
                             review_text=form.cleaned_data['text'],
                             type=ShortReview.TYPE_SHORT_REVIEW)
            sr.save()
    form = WallForm()

    activities = UserActivity.objects.wall_filter(request)

    activities = ajax_activity_pager(request, activities)

    data = {
        'activities': activities,
        'profile': profile,
        'form': form,
        'filter': filter,
    }

    return render(request, ajax_select_template(request,
                                                templates['DASHBOARD']), data)
Beispiel #5
0
def _public_profile(request, username, activity_option):
    """
        Show public user profile
    """
    try:
        user = User.objects.get(username__iexact=username)
    except User.DoesNotExist:
        raise Http404

    if activity_option == 'user_all':
        activities = UserActivity.objects.all_for_user(user)
    else:
        activities = UserActivity.objects.public()

    activities = ajax_activity_pager(request, activities)

    data = {
        'activities': activities,
        'user_profile': user,
    }

    return render(request, ajax_select_template(request, templates['PROFILE']),
                  data)