Exemple #1
0
def feed_create(request):
    """
    Creates a feed
    """
    user = get_object_or_404(User, id=request.user.id)
    my_feeds = Feed.objects.filter(publisher=user)

    form = CreateFeedForm()

    if request.method == 'POST':
        form = CreateFeedForm(request.POST)

        if form.is_valid():
            feed = form.save(user=user)
            url = reverse('feed_detail_dashboard', args=[
                feed.publisher.username,
                feed.slug
            ])
            return HttpResponseRedirect(url)

    return render_to_response('core/feeds/create.html', {
        'form': form,
        'my_feeds': my_feeds,
        'page_name': 'feed_create',
    }, RequestContext(request))
Exemple #2
0
def user_share(request):
    """
    User detail view
    """
    user = get_object_or_404(User, id=request.user.id)

    form = CreateFeedForm()

    if request.method == 'POST':
        form = CreateFeedForm(request.POST)

        if form.is_valid():
            feed = form.save(user=user)
            url = reverse('feed_detail', args={
                'username': feed.publisher.username,
                'slug': feed.slug
            })
            return HttpResponseRedirect(url)

    return render_to_response('core/users/share.html', {
        'form': form,
        'page_name': 'share',
    }, RequestContext(request))