List Info

Thread: How to pass extra attributes to User authentication view?




How to pass extra attributes to User authentication view?
user name
2007-12-22 07:08:01
To allow users to log-in,
I have something like this in urls.py

(r'^accounts/login/$', 'django.contrib.auth.views.login',
{'template_name': 'myapp/login.html'}),

But myapp/login.html expects a number of extra objects from
that
populated by the login view. In other generic views, I could
have
added extra objects by using extra_context optional method.
But this
view does not take the extra_context optional argument., so
how can I
pass extra objects to the template?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: How to pass extra attributes to User authentication view?
country flaguser name
United States
2007-12-30 12:58:11
shabda wrote:
> But myapp/login.html expects a number of extra objects
from that
> populated by the login view. In other generic views, I
could have
> added extra objects by using extra_context optional
method. But this
> view does not take the extra_context optional
argument., so how can I
> pass extra objects to the template
Hello,

To do this, my first guess would be to write your own view
that extends
django.contrib.auth.views.login

def myLogin(django.contrib.auth.views.login):
    pass

From there, you can add your own variables, and return the
correct
response for that template.
Hopefully this can yoint you in the right direction.

Jeff Anderson

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )