Project

General

Profile

« Previous | Next » 

Revision 0a4f779f

Added by Mikaël Ates almost 10 years ago

personnes: show inactive accesses and allow to re-active an access.

View differences:

calebasse/personnes/views.py
56 56
    def get_context_data(self, **kwargs):
57 57
        ctx = super(AccessView, self).get_context_data(**kwargs)
58 58
        ctx['active_list'] = ctx['object_list'].filter(is_active=True)
59
        ctx['inactive_list'] = ctx['object_list'].filter(is_active=False)
59 60
        return ctx
60 61

  
61 62

  
......
132 133
class UserDisactivateView(cbv.DeleteView):
133 134
    model = User
134 135
    success_url = "../../"
135
    template_name = 'calebasse/generic_confirm_delete.html'
136
    template_name = 'personnes/disactivate_access.html'
136 137

  
137 138
    def delete(self, request, *args, **kwargs):
138 139
        self.object = self.get_object()
......
140 141
        self.object.save()
141 142
        return HttpResponseRedirect(self.get_success_url())
142 143

  
144
class UserActivateView(cbv.DeleteView):
145
    model = User
146
    success_url = "../../"
147
    template_name = 'personnes/activate_access.html'
148

  
149
    def delete(self, request, *args, **kwargs):
150
        self.object = self.get_object()
151
        self.object.is_active = True
152
        self.object.save()
153
        return HttpResponseRedirect(self.get_success_url())
143 154

  
144 155
user_new = super_user_only(UserCreateView.as_view())
145 156
user_update = super_user_only(AccessUpdateView.as_view())
146 157
user_delete = super_user_only(UserDisactivateView.as_view())
158
user_activate = super_user_only(UserActivateView.as_view())
147 159

  
148 160

  
149 161
class WorkerUpdateView(cbv.ServiceViewMixin, cbv.MultiUpdateView):

Also available in: Unified diff