Add logout + Viewset name problem from migration
This commit is contained in:
parent
68d7a1577d
commit
9f1564edf3
3 changed files with 8 additions and 8 deletions
|
|
@ -47,6 +47,9 @@ class CustomLoginView(LoginView):
|
|||
self.request.session['permission_mask'] = 42#form.cleaned_data['permission_mask'].rank
|
||||
return super().form_valid(form)
|
||||
|
||||
def logout_view(request):
|
||||
logout(request)
|
||||
return redirect('index')
|
||||
|
||||
class UserUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ def register_note_urls(router, path):
|
|||
router.register(path + '/note', NotePolymorphicViewSet)
|
||||
router.register(path + '/alias', AliasViewSet)
|
||||
router.register(path + '/trust', TrustViewSet)
|
||||
router.register(path + '/consumer', ConsumerViewSet)
|
||||
router.register(path + '/consumer', ConsumerViewSet,"consumer")
|
||||
|
||||
router.register(path + '/transaction/category', TemplateCategoryViewSet)
|
||||
router.register(path + '/transaction/transaction', TransactionViewSet)
|
||||
|
|
|
|||
|
|
@ -3,13 +3,15 @@
|
|||
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
import django.contrib.auth.views
|
||||
from django.urls import path, include
|
||||
from django.views.defaults import bad_request, permission_denied, page_not_found, server_error
|
||||
from member.views import CustomLoginView
|
||||
from member.views import CustomLoginView, logout_view
|
||||
|
||||
from .admin import admin_site
|
||||
from .views import IndexView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
# Dev so redirect to something random
|
||||
path('', IndexView.as_view(), name='index'),
|
||||
|
|
@ -26,6 +28,7 @@ urlpatterns = [
|
|||
path('admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
path('admin/', admin_site.urls, name="admin"),
|
||||
path('accounts/login/', CustomLoginView.as_view()),
|
||||
path('accounts/logout/', logout_view),
|
||||
path('accounts/', include('django.contrib.auth.urls')),
|
||||
path('api/', include('api.urls')),
|
||||
path('permission/', include('permission.urls')),
|
||||
|
|
@ -47,12 +50,6 @@ if "cas_server" in settings.INSTALLED_APPS:
|
|||
path('cas/', include('cas_server.urls', namespace='cas_server'))
|
||||
)
|
||||
|
||||
if "debug_toolbar" in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
urlpatterns = [
|
||||
path('__debug__/', include(debug_toolbar.urls)),
|
||||
] + urlpatterns
|
||||
|
||||
|
||||
handler400 = bad_request
|
||||
handler403 = permission_denied
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue