Re: How to restrict a class based view to one user group?

2014-11-06 Thread Daniel Grace
Thanks Bruno, I was decorating the 'post' method. I've got it right now. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to

Re: How to restrict a class based view to one user group?

2014-11-06 Thread Daniel Grace
I solved this using a "method_decorator" and "user_passes_test". -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To

Re: How to restrict a class based view to one user group?

2014-11-06 Thread Bruno Barcarol GuimarĂ£es
Hi Daniel. You're looking for the `user_passes_test` decorator: https://docs.djangoproject.com/en/1.7/topics/auth/default/#limiting-access-to-logged-in-users-that-pass-a-test Remember you need to decorate the `dispatch` method of a CBV. -- You received this message because you are subscribed

How to restrict a class based view to one user group?

2014-11-05 Thread Daniel Grace
Hi, Say I have a function as follows: def is_supervisor(user): return user.groups.filter(name='supervisor').exists() ...and a CBV for deleting records: class DeleteFlow(DeleteView): # etc... How can I restrict access to this view using the function? I understand that this may be