from django.urls import path, re_path from catalog.models import item_categories from .models import ShelfType from .views import * app_name = "journal" def _get_all_categories(): res = "|".join(item_categories().keys()) return res def _get_all_shelf_types(): return "|".join(ShelfType.values) urlpatterns = [ path("wish/", wish, name="wish"), path("mark/", mark, name="mark"), path("comment/", comment, name="comment"), path("item//note", note_edit, name="note"), path("item//note/", note_edit, name="note"), path("piece//replies", piece_replies, name="piece_replies"), path("post//replies", post_replies, name="post_replies"), path("post//delete", post_delete, name="post_delete"), path("post//reply", post_reply, name="post_reply"), path("post//boost", post_boost, name="post_boost"), path("post//like", post_like, name="post_like"), path("post//unlike", post_unlike, name="post_unlike"), path("mark_log//", mark_log, name="mark_log"), path( "add_to_collection/", add_to_collection, name="add_to_collection" ), path("review/", review_retrieve, name="review_retrieve"), path("review/create//", review_edit, name="review_create"), path( "review/edit//", review_edit, name="review_edit" ), path("review/delete/", piece_delete, name="review_delete"), re_path( r"^collection/(?P[A-Za-z0-9]{21,22})$", collection_retrieve, name="collection_retrieve", ), re_path( r"^collection/(?P[A-Za-z0-9]{21,22})/$", collection_retrieve_redirect, name="collection_retrieve_redirect", ), path("collection/create/", collection_edit, name="collection_create"), path( "collection/edit/", collection_edit, name="collection_edit" ), path("collection/delete/", piece_delete, name="collection_delete"), path( "collection/share/", collection_share, name="collection_share", ), path( "collection//items", collection_retrieve_items, name="collection_retrieve_items", ), path( "collection//append_item", collection_append_item, name="collection_append_item", ), path( "collection//remove_item/", collection_remove_item, name="collection_remove_item", ), path( "collection//collection_update_member_order", collection_update_member_order, name="collection_update_member_order", ), path( "collection//update_item_note/", collection_update_item_note, name="collection_update_item_note", ), path( "collection//add_featured", collection_add_featured, name="collection_add_featured", ), path( "collection//remove_featured", collection_remove_featured, name="collection_remove_featured", ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/(?P" + _get_all_shelf_types() + ")/(?P" + _get_all_categories() + ")/$", user_mark_list, name="user_mark_list", ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/reviews/(?P" + _get_all_categories() + ")/$", user_review_list, name="user_review_list", ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/tags/(?P.+)/$", user_tag_member_list, name="user_tag_member_list", ), path( "tag/edit", user_tag_edit, name="user_tag_edit", ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/collections/$", user_collection_list, name="user_collection_list", ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/like/collections/$", user_liked_collection_list, name="user_liked_collection_list", ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/tags/$", user_tag_list, name="user_tag_list", ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/$", profile, name="user_profile" ), re_path( r"^users/(?P[~A-Za-z0-9_\-.@]+)/calendar_data$", user_calendar_data, name="user_calendar_data", ), path("users//feed/reviews/", ReviewFeed(), name="review_feed"), path("wrapped/", WrappedView.as_view(), name="wrapped_current_year"), path("wrapped//", WrappedView.as_view(), name="wrapped"), path("wrapped//share", WrappedShareView.as_view(), name="wrapped_share"), ]