Re: Django Contrib Auth + Class Based Generic Views
As I understand you would like to send some values to the templates ?
Are you eould like to check if user is authenticated ?
I 've understand near to nothing from your last message.
2012/4/5 Matheus Ashton <matheusashton@gmail.com>:
> Ok, Thanks for the advices :) but I still have the original problem, when i
> access the HomeView the template is rendered with a render_to_response view,
> with a simple Context object and not a RequestContext object, because of
> that I do not have the authenticated user data in my template...
>
>
> 2012/4/4 Sergiy Khohlov <skhohlov@gmail.com>
>>
>> Sound good!
>> Usually project is not so simple (only url.py + settings.py)
>>
>> 2012/4/4 Javier Guerra Giraldez <javier@guerrag.com>:
>> > On Wed, Apr 4, 2012 at 4:14 AM, Sergiy Khohlov <skhohlov@gmail.com>
>> > wrote:
>> >> As result your views.py should be :
>> >>
>> >> from django.views.generic import TemplateView
>> >> # Create your views here.
>> >> class HomeView(TemplateView):
>> >> template_name='home.html'
>> >>
>> >> Only three lines of the code !
>> >> You dont need more!
>> >
>> > if in urls.py you replace
>> >
>> > (r'^$', login_required(HomeView.as_view())),
>> >
>> > with
>> > (r'^$',
>> > login_required(TemplateView(template_name='home.html').as_view())),
>> >
>> >
>> > you don't need any HomeView class!
>> >
>> >
>> > --
>> > Javier
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscribe@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home