def postinternal(request): if request.method != 'POST' or 'secret' not in request.POST or request.POST['secret'] != 'SECRET!': raise Http404() profile = get_object_or_404(Profile, jid=request.POST['jid']) entry = Entry(owner=profile, content=request.POST['content'], post_date=datetime.now()) entry.save() try: entry.parse_post() entry.save() entry.publish() except: entry.delete() raise return HttpResponse('OK')
def postinternal(request): if request.method != 'POST' or 'secret' not in request.POST or request.POST[ 'secret'] != 'SECRET!': raise Http404() profile = get_object_or_404(Profile, jid=request.POST['jid']) entry = Entry(owner=profile, content=request.POST['content'], post_date=datetime.now()) entry.save() try: entry.parse_post() entry.save() entry.publish() except: entry.delete() raise return HttpResponse('OK')
def postentry(request): if request.method == 'POST': form = PostEntryForm(request.POST) if form.is_valid(): profile = Profile.objects.get_or_create(user=request.user)[0] entry = Entry(owner=profile, content=form.cleaned_data['content'], post_date=datetime.now()) entry.save() try: entry.parse_post() entry.save() entry.publish() except: entry.delete() raise next = urlresolvers.reverse('microblog_index') return HttpResponseRedirect(next + "?posted=1") else: form = PostEntryForm() return render_to_response('microblog/postentry.html', { 'form': form })
def postentry(request): if request.method == 'POST': form = PostEntryForm(request.POST) if form.is_valid(): profile = Profile.objects.get_or_create(user=request.user)[0] entry = Entry(owner=profile, content=form.cleaned_data['content'], post_date=datetime.now()) entry.save() try: entry.parse_post() entry.save() entry.publish() except: entry.delete() raise next = urlresolvers.reverse('microblog_index') return HttpResponseRedirect(next + "?posted=1") else: form = PostEntryForm() return render_to_response('microblog/postentry.html', {'form': form})