Пример #1
0
def fresh(request):
    if request.method == 'POST':
        u = User.objects.create_user(request.POST['uName'], request.POST['email'], request.POST['uPass'])
        p = post(postedBy = u, postedDate = timezone.now(), title=request.POST['title'], content=request.POST['content'], url=slugify(request.POST['title']))
        p.save()
        au = authenticate(username=request.POST['uName'], password=request.POST['uPass'])
        login(request, au)

        return redirect('/u/'+u.username)
    else:
        return redirect('/start')
Пример #2
0
def createPost(request):
    u = request.user
    p = post(title = request.POST['title'], url = slugify(request.POST['title']), content = request.POST['content'], postedDate = timezone.now(), postedBy = u)
    p.save()
    return redirect('/u/'+u.username+'/'+p.url)