from django.contrib.auth import views as auth_views
from django.urls import path

from .forms import LoginForm
from .views import entry_detail, entry_list, home, signup

urlpatterns = [
    path("", home, name="home"),
    path("entries/", entry_list, name="entry_list"),
    path("entries/<int:pk>/", entry_detail, name="entry_detail"),
    path(
        "login/",
        auth_views.LoginView.as_view(
            template_name="registration/login.html",
            redirect_authenticated_user=True,
            authentication_form=LoginForm,
        ),
        name="login",
    ),
    path("logout/", auth_views.LogoutView.as_view(next_page="home"), name="logout"),
    path("signup/", signup, name="signup"),
]
