this is my  login view ...

def login(request):
    # c = {}
    # c.update(csrf(request))
    return render(request, 'envato.rathemes.com/infinity/topbar/login.html')


def auth_view(request):
    username = request.POST.get('username', '')
    password = request.POST.get('password', '')
    user = auth.authenticate(username=username, password=password)
    if user is not None:
        auth.login(request, user)
        return redirect('message_board:list')
    else:
        return HttpResponse('notauthenticate....please login with correct 
detail', status=403)


Im trying to go on new app and the urls for new app is this --


urlpatterns = [
    url(r'^message_board/$', views.message, name='message'),
    url(r'^message_board/post_new$', views.post_new, name='post_new'),
    #url(r'^message_board/post_detail$', views.post_detail, name='post_detail')
    url(r'^message_board/post_detail/(?P<pk>\d+)/$', views.post_detail, 
name='post_detail'),
]                              


and message board view is this -----



def message(request):
    posts = Post.objects.order_by('-created_date')
    return render(request, 'post_list.html', {'xyz': posts})


@login_required
def post_new(request):
    if request.method == "POST":
        form = PostForm(request.POST)
        if form.is_valid():
            post = form.save(commit=False)
            post.author = request.user
            post.published_date = timezone.now()
            post.save()
            return redirect('message_board:list')
    else:
        form = PostForm()
    return render(request, 'post_edit.html', {'form': form})





please help me please......

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/832b97b8-0d25-4718-86ee-7ae87599f163%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to