Re: Django Contrib Auth + Class Based Generic Views

2012-04-04 Thread Sergiy Khohlov
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 : > Ok, Thanks for the advices :) but I still have the original problem, when i > access t

Re: Django Contrib Auth + Class Based Generic Views

2012-04-04 Thread Matheus Ashton
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/

Re: Django Contrib Auth + Class Based Generic Views

2012-04-04 Thread Sergiy Khohlov
Sound good! Usually project is not so simple (only url.py + settings.py) 2012/4/4 Javier Guerra Giraldez : > On Wed, Apr 4, 2012 at 4:14 AM, Sergiy Khohlov wrote: >> As result  your views.py should be : >> >> from django.views.generic import TemplateView >> # Create your views here. >> class Hom

Re: Django Contrib Auth + Class Based Generic Views

2012-04-04 Thread Javier Guerra Giraldez
On Wed, Apr 4, 2012 at 4:14 AM, Sergiy Khohlov 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 i

Re: Django Contrib Auth + Class Based Generic Views

2012-04-04 Thread Sergiy Khohlov
So much code . Ok, lets start 2012/4/4 Matheus Ashton : > urls.py: > > urlpatterns = patterns('', >     url(r'^/login$', LoginView.as_view()), >     url(r'^$', HomeView.as_view(), {}, 'home'), > ) > More simple way is using decorator for checking if user is authorized. Add next string to

Re: Django Contrib Auth + Class Based Generic Views

2012-04-03 Thread Matheus Ashton
urls.py: urlpatterns = patterns('', url(r'^/login$', LoginView.as_view()), url(r'^$', HomeView.as_view(), {}, 'home'), ) settings.py: LOGIN_URL='/login/' views.py: class LoginView(FormView): form_class = LoginForm template_name = "auth/form.html" def post(self, request, *args,

Re: Django Contrib Auth + Class Based Generic Views

2012-04-03 Thread Sergiy Khohlov
Please provide your urls.py and your view which is used for this 2012/4/3 Matheus Ashton : > Hello Everybody, > > I'm having a problem using the django.contrib.auth app and class based > generic views in Django 1.3 / 1.4: > > After submitting the login form, my view receives the post data a

Django Contrib Auth + Class Based Generic Views

2012-04-02 Thread Matheus Ashton
Hello Everybody, I'm having a problem using the django.contrib.auth app and class based generic views in Django 1.3 / 1.4: After submitting the login form, my view receives the post data and tries to authenticate the user and then redirect to a success page. Ok nothing new.. The problem is: My