def add_tweet(request):
	form = TweetForm()
	if request.method == 'POST':
		form = TweetForm(request.POST)
		if form.is_valid():
			form.save()
			return redirect('home')
	return render_to_response('add_user.html', {
		'form': form,
	}, RequestContext(request))
Ejemplo n.º 2
0
def sesion(request):

    tweet = Tweet.objects.all()
    form = TweetForm()
    if request.method == "POST":
        form = TweetForm(request.POST)
        if form.is_valid():
            form.save()
            return redirect("sesion")
    return render_to_response("sesion.html", {"form": form, "tweet": tweet}, RequestContext(request))
def edit_twitt(request, pk):
    tweet = get_object_or_404(Tweet, pk=pk)
    form = TweetForm(instance=tweet)
    if request.method == 'POST':
        form = TweetForm(request.POST, instance=tweet)
        if form.is_valid():
            form.save()
            return redirect(index)
    return render_to_response('add_twitt.html', {
        'form': form,
        }, RequestContext(request))
Ejemplo n.º 4
0
Archivo: views.py Proyecto: baronn/assd
def edit_tweet(request, pk):
    tweet = Tweet.objects.get(pk=pk)
    form = TweetForm(instance=tweet)
    if request.method == 'POST':
        form = TweetForm(request.POST, instance=tweet)
        if form.is_valid():
            form.save()
            return redirect('home')
    return render_to_response('add_tweet.html', {
        'form': form,
        }, RequestContext(request))
Ejemplo n.º 5
0
def edit_tweet(request, pk):
    tweet = Tweet.objects.get(pk=pk)
    form = TweetForm(instance=tweet)
    if request.method == 'POST':
        form = TweetForm(request.POST, instance=tweet)
        if form.is_valid():
            form.save()
            user = UserProfile.objects.get(user=request.user)
            return redirect('profile', username=user.user.username)
    return render_to_response('add_tweet.html', {
        'form': form,
        }, RequestContext(request))