[BangPypers] Django Jquey List View issu

ragsagar ragsagar at gmail.com
Tue Feb 19 08:10:35 CET 2013


It would have better if you have shared the code using dpase or some
pastebin, because it not that readable here. I am assuming your problem is
this. After login, the index.html page is rendering but you cannot the see
the list of items. If this is the problem do the following.
1) Get the url name of the url which is mapped to the view which renders
index.html.
2) if 'render_index_page' is the url name, do the following.

if user is not None and user.is_active:
    login(request, user)
    return HttpResponseRedirect(reverse('render_index_page'))
else:
    # Not logged

Then you don't have to set username in cookie or pass it to template like
that. You can access username like this without passing anything in
template if user is logged in.
{{ user.username }}



Thanks,
Rag


On Tue, Feb 19, 2013 at 12:30 PM, JAGANADH G <jaganadhg at gmail.com> wrote:

> On Mon, Feb 18, 2013 at 10:26 PM, anirudh bhat <abhat38 at gmail.com> wrote:
>
> > Hello Jaganadh, your question is too abstract.Maybe you can show us some
> > code u have written if you dont mind.There maybe lot of things that can
> go
> > wrong here....one such example  is that maybe there is some problem with
> > your Jquery code.Is page redirecting done right?? what does your django
> > error log says??
> >
> >
> >
>
> Hi
> This is the code which redirects the page
>
> def user_login(request):
>         cache.clear()
>         request.session.flush()
>         """
>         Logging the user to the system
>         """
>         state = "Login  using your credentials"
>         username,password = "",""
>         if request.POST:
>                 username = request.POST.get('username')
>                 password = request.POST.get('password')
>
>                 user = authenticate(username= username,password=password)
>                 request.COOKIES['username'] = username
>                 if user is not None and user.is_authenticated():
>                         if user.is_active:
>                                 login(request,user)
>                                 state = "Your login was successful !"
>                                 cookie_name = request.COOKIES['username']
>                                 #return
>
> redirect('/index/',{'username':username},RequestContext(request,{'username':username}))
>                                 #return
> HttpResponseRedirect('/index/',{'username':cookie_name})
>                                 #return
> redirect('/index/',{'username':cookie_name})
>                                 #return
> render_to_response('Index.html',{'username':cookie_name})
>                                 #return
> redirect('/index/',{'username':cookie_name})
>                                 return
> render_to_response('Index.html',{'username':cookie_name})
>                 else:
>                         state = "Your credentials are incorrect !"
>         return
> render_to_response("Login.html",{'state':state,'username':username})
>
>
> --
> **********************************
> JAGANADH G
> http://jaganadhg.in
> *ILUGCBE*
> http://ilugcbe.org.in
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
blog : ragsagar.wordpress.com
mail id : python -c "print '@'.join(['ragsagar','.'.join([x for x in
['gmail','com']])])"


More information about the BangPypers mailing list