from django.urls import re_path
from django.contrib.auth import views as auth_views
from .views import (
    index,
    blog_create,
    blog_delete,
    blog_update,
    blog_view,
    comment_add,
    comment_delete,
    comment_update,
    comments_view
)

urlpatterns = [
    re_path(r'^$', index, name='index'),
    
    re_path(r'^create_blog$', blog_create, name='create_blog'),
    re_path(r'^delete_blog/(?P<blog_id>\d+)$', blog_delete, name='delete_blog'),
    re_path(r'^edit_blog/(?P<blog_id>\d+)$', blog_update, name='edit_blog'),
    re_path(r'^view_blog/(?P<blog_id>\d+)$', blog_view, name='view_blog'),
    
    re_path(r'^add_comment/(?P<blog_id>\d+)$', comment_add, name='add_comment'),
    re_path(r'^delete_comment/(?P<comment_id>\d+)$', comment_delete, name='delete_comment'),
    re_path(r'^edit_comment/(?P<comment_id>\d+)$', comment_update, name='edit_comment'),
    re_path(r'^view_comments$', comments_view, name='view_comments'),
    
    re_path(r"^login$", 
        auth_views.LoginView.as_view(template_name="login.html"), 
        name="login"),
        
    re_path(r"^logout$", 
        auth_views.LogoutView.as_view(next_page="blog:index"), 
        name="logout")
]
