Ejemplo n.º 1
0
def wall(request, username):
    user = get_object_or_404(User, username=username)
    lets = user.lets.all()
    category = clean_category(request.GET.get('category'))
    if category:
        lets = lets.filter(category=category)
    pages = paginate(request, lets, lcs.LETS_PER_PAGE)
    data = {'pages': pages, 'catg': CATEGORY_CHOICES, 'profile': user.profile}
    return jingo.render(request, 'lets/wall.html', data)
Ejemplo n.º 2
0
def activities(request, category=None, home_tab=None):
    search_lets = get_relevant_lets(
        request.user, page=request.GET.get('page'),
        category=request.GET.get('category'))
    pages = paginate(request, search_lets['ids'], lcs.LETS_PER_PAGE)
    data = {'lets': search_lets['results'], 'catg': CATEGORY_CHOICES,
            'pages': pages, 'profile': request.user.profile}

    if not home_tab:
        from users.models import Setting
        home_tab = Setting.get_for_user(request.user, 'home_tab')
        if home_tab != 'lets':
            from users.forms import SettingsForm
            form = SettingsForm(data={'home_tab': 'lets'})
            form.is_valid()
            form.save_for_user(request.user)

    return jingo.render(request, 'lets/activities.html', data)