Hi,
I'd like to add user permissions to my application.
To update, add, and delete objects I use generic views.
In my views.py file I've got:

[code]
@permission_required_with_error('ReservationSlot.can_update',
url='ResourceScheduler/error.html', login_url='/ResourceScheduler/
login')
def limited_update_object(*args, **kwargs):
          return update_object(*args, **kwargs)
[/code]

where permission_required_with_error function is decorator for views
that checks whether a
user has a particular permission enabled, redirecting to the log-in
page or rendering en
error as necessary (it's a snippet with a little modification).

In my loggin function in views.py  I've got:
[code]
                if user.is_active:
                        permissions = user.get_all_permissions()

                        # Correct password, and the user is marked
"active"
                        auth.login(request, user)
 
request.session[settings.PERSISTENT_SESSION_KEY]
=                              form.clean_data['remember_user']

                        # Redirect to a success
page.
                        return HttpResponseRedirect("/ResourceScheduler/" )
[/code]

user.get_all_permissions() returns all permissions added in admin
panel. The problem is that whenewer I want to update or delete and the
user is not admin, en error "you don't have permissions" occurs. It
seems that permisions are invisible for update and delete templates.

I'm new in Djano so it may seem a simple question but is there some
way to pass on user permissions?

Thanks in advance,
Ana


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to