lib.itmens/journal/urls.py

152 lines
5.1 KiB
Python
Raw Normal View History

2022-12-21 14:34:36 -05:00
from django.urls import path, re_path
2023-08-10 14:56:38 -04:00
from catalog.models import item_categories
2022-12-21 14:34:36 -05:00
2023-08-10 14:56:38 -04:00
from .models import ShelfType
from .views import *
2022-12-21 14:34:36 -05:00
2022-12-29 14:30:31 -05:00
app_name = "journal"
2022-12-27 14:52:03 -05:00
def _get_all_categories():
res = "|".join(item_categories().keys())
2022-12-27 14:52:03 -05:00
return res
def _get_all_shelf_types():
return "|".join(ShelfType.values)
2022-12-21 14:34:36 -05:00
urlpatterns = [
2022-12-29 14:30:31 -05:00
path("wish/<str:item_uuid>", wish, name="wish"),
path("mark/<str:item_uuid>", mark, name="mark"),
path("comment/<str:item_uuid>", comment, name="comment"),
2024-06-15 18:26:20 -04:00
path("item/<str:item_uuid>/note", note_edit, name="note"),
path("item/<str:item_uuid>/note/<str:note_uuid>", note_edit, name="note"),
2023-08-15 15:46:11 -04:00
path("piece/<str:piece_uuid>/replies", piece_replies, name="piece_replies"),
path("post/<int:post_id>/replies", post_replies, name="post_replies"),
2024-06-20 16:01:21 -04:00
path("post/<int:post_id>/delete", post_delete, name="post_delete"),
2023-08-15 15:46:11 -04:00
path("post/<int:post_id>/reply", post_reply, name="post_reply"),
2023-12-29 16:03:31 -05:00
path("post/<int:post_id>/boost", post_boost, name="post_boost"),
2023-08-15 15:46:11 -04:00
path("post/<int:post_id>/like", post_like, name="post_like"),
path("post/<int:post_id>/unlike", post_unlike, name="post_unlike"),
path("mark_log/<str:item_uuid>/<int:log_id>", mark_log, name="mark_log"),
2022-12-29 14:30:31 -05:00
path(
"add_to_collection/<str:item_uuid>", add_to_collection, name="add_to_collection"
),
path("review/<str:review_uuid>", review_retrieve, name="review_retrieve"),
path("review/create/<str:item_uuid>/", review_edit, name="review_create"),
path(
"review/edit/<str:item_uuid>/<str:review_uuid>", review_edit, name="review_edit"
),
path("review/delete/<str:piece_uuid>", piece_delete, name="review_delete"),
2024-01-08 22:42:58 -05:00
re_path(
r"^collection/(?P<collection_uuid>[A-Za-z0-9]{21,22})$",
2022-12-29 14:30:31 -05:00
collection_retrieve,
name="collection_retrieve",
),
2024-01-08 22:42:58 -05:00
re_path(
r"^collection/(?P<collection_uuid>[A-Za-z0-9]{21,22})/$",
2023-12-26 18:57:09 -05:00
collection_retrieve_redirect,
name="collection_retrieve_redirect",
),
2022-12-29 14:30:31 -05:00
path("collection/create/", collection_edit, name="collection_create"),
path(
"collection/edit/<str:collection_uuid>", collection_edit, name="collection_edit"
),
path("collection/delete/<str:piece_uuid>", piece_delete, name="collection_delete"),
2023-01-05 03:06:13 -05:00
path(
"collection/share/<str:collection_uuid>",
collection_share,
name="collection_share",
),
2022-12-29 14:30:31 -05:00
path(
"collection/<str:collection_uuid>/items",
collection_retrieve_items,
name="collection_retrieve_items",
),
path(
"collection/<str:collection_uuid>/append_item",
collection_append_item,
name="collection_append_item",
),
path(
"collection/<str:collection_uuid>/remove_item/<str:item_uuid>",
collection_remove_item,
name="collection_remove_item",
),
path(
"collection/<str:collection_uuid>/collection_update_member_order",
collection_update_member_order,
name="collection_update_member_order",
2022-12-29 14:30:31 -05:00
),
path(
"collection/<str:collection_uuid>/update_item_note/<str:item_uuid>",
collection_update_item_note,
name="collection_update_item_note",
),
2023-01-13 23:48:28 -05:00
path(
"collection/<str:collection_uuid>/add_featured",
collection_add_featured,
name="collection_add_featured",
),
path(
"collection/<str:collection_uuid>/remove_featured",
collection_remove_featured,
name="collection_remove_featured",
),
2022-12-29 14:30:31 -05:00
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/(?P<shelf_type>"
2022-12-29 14:30:31 -05:00
+ _get_all_shelf_types()
+ ")/(?P<item_category>"
+ _get_all_categories()
+ ")/$",
user_mark_list,
name="user_mark_list",
),
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/reviews/(?P<item_category>"
2022-12-29 14:30:31 -05:00
+ _get_all_categories()
+ ")/$",
user_review_list,
name="user_review_list",
),
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/tags/(?P<tag_title>.+)/$",
2022-12-29 14:30:31 -05:00
user_tag_member_list,
name="user_tag_member_list",
),
2023-01-26 16:57:47 -05:00
path(
"tag/edit",
user_tag_edit,
name="user_tag_edit",
),
2022-12-29 14:30:31 -05:00
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/collections/$",
2022-12-29 14:30:31 -05:00
user_collection_list,
name="user_collection_list",
),
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/like/collections/$",
2022-12-29 14:30:31 -05:00
user_liked_collection_list,
name="user_liked_collection_list",
),
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/tags/$",
2022-12-29 14:30:31 -05:00
user_tag_list,
name="user_tag_list",
),
2023-04-20 13:36:12 -04:00
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/$", profile, name="user_profile"
),
re_path(
r"^users/(?P<user_name>[~A-Za-z0-9_\-.@]+)/calendar_data$",
2023-04-20 13:36:12 -04:00
user_calendar_data,
name="user_calendar_data",
),
2023-12-31 08:32:19 -05:00
path("users/<str:username>/feed/reviews/", ReviewFeed(), name="review_feed"),
2024-05-15 03:18:27 -04:00
path("wrapped/", WrappedView.as_view(), name="wrapped_current_year"),
2023-12-22 23:59:48 -05:00
path("wrapped/<int:year>/", WrappedView.as_view(), name="wrapped"),
path("wrapped/<int:year>/share", WrappedShareView.as_view(), name="wrapped_share"),
2022-12-21 14:34:36 -05:00
]