"""URLs module"""
from django.urls import path
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from . import views


app_name = "helusers"

urlpatterns = []

if (
    "social_django" in settings.INSTALLED_APPS
    and "helusers.tunnistamo_oidc.TunnistamoOIDCAuth"
    in settings.AUTHENTICATION_BACKENDS
):
    if not settings.LOGOUT_REDIRECT_URL:
        raise ImproperlyConfigured(
            "You must configure LOGOUT_REDIRECT_URL to use helusers views."
        )

    urlpatterns.extend(
        [
            path("logout/", views.LogoutView.as_view(), name="auth_logout"),
            path(
                "logout/complete/",
                views.LogoutCompleteView.as_view(),
                name="auth_logout_complete",
            ),
            path("login/", views.LoginView.as_view(), name="auth_login"),
        ]
    )

"""URLs module"""
from django.urls import path
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from . import views


app_name = "helusers"

urlpatterns = []

if not settings.LOGOUT_REDIRECT_URL:
    raise ImproperlyConfigured(
        "You must configure LOGOUT_REDIRECT_URL to use helusers views."
    )

urlpatterns.extend(
    [
        path("logout/", views.LogoutView.as_view(), name="auth_logout"),
        path(
            "logout/complete/",
            views.LogoutCompleteView.as_view(),
            name="auth_logout_complete",
        ),
        path("login/", views.LoginView.as_view(), name="auth_login"),
    ]
)

--- 
+++ 
@@ -9,19 +9,24 @@
 
 urlpatterns = []
 
-if not settings.LOGOUT_REDIRECT_URL:
-    raise ImproperlyConfigured(
-        "You must configure LOGOUT_REDIRECT_URL to use helusers views."
+if (
+    "social_django" in settings.INSTALLED_APPS
+    and "helusers.tunnistamo_oidc.TunnistamoOIDCAuth"
+    in settings.AUTHENTICATION_BACKENDS
+):
+    if not settings.LOGOUT_REDIRECT_URL:
+        raise ImproperlyConfigured(
+            "You must configure LOGOUT_REDIRECT_URL to use helusers views."
+        )
+
+    urlpatterns.extend(
+        [
+            path("logout/", views.LogoutView.as_view(), name="auth_logout"),
+            path(
+                "logout/complete/",
+                views.LogoutCompleteView.as_view(),
+                name="auth_logout_complete",
+            ),
+            path("login/", views.LoginView.as_view(), name="auth_login"),
+        ]
     )
-
-urlpatterns.extend(
-    [
-        path("logout/", views.LogoutView.as_view(), name="auth_logout"),
-        path(
-            "logout/complete/",
-            views.LogoutCompleteView.as_view(),
-            name="auth_logout_complete",
-        ),
-        path("login/", views.LoginView.as_view(), name="auth_login"),
-    ]
-)
Include social_auth specific URLs only if social_auth is in use
