lib.itmens/catalog/urls.py

140 lines
3.8 KiB
Python
Raw Normal View History

2022-12-15 17:29:35 -05:00
from django.urls import path, re_path
2022-12-16 01:08:10 -05:00
from .models import *
from .views import *
2022-12-16 01:08:10 -05:00
2022-12-29 23:57:02 -05:00
app_name = "catalog"
2022-12-24 01:28:24 -05:00
2022-12-16 01:08:10 -05:00
def _get_all_url_paths():
2022-12-29 23:57:02 -05:00
paths = ["item"]
2022-12-16 01:08:10 -05:00
for cls in Item.__subclasses__():
2022-12-29 23:57:02 -05:00
p = getattr(cls, "url_path", None)
2022-12-16 01:08:10 -05:00
if p:
paths.append(p)
res = "|".join(paths)
return res
2022-12-15 17:29:35 -05:00
urlpatterns = [
2022-12-29 23:57:02 -05:00
re_path(
2023-01-05 03:06:13 -05:00
r"^item/(?P<item_uid>[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})$",
2022-12-29 23:57:02 -05:00
retrieve_by_uuid,
name="retrieve_by_uuid",
),
2023-02-10 15:56:13 -05:00
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/embed$",
embed,
name="embed",
),
2022-12-29 23:57:02 -05:00
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})$",
retrieve,
name="retrieve",
),
path("podcast/<str:item_uuid>/episodes", episode_data, name="episode_data"),
2023-01-05 03:06:13 -05:00
path("catalog/create/<str:item_model>", create, name="create"),
2023-06-19 12:30:39 -04:00
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/history$",
history,
name="history",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/edit$",
edit,
name="edit",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/delete$",
delete,
name="delete",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
2023-05-13 15:11:05 -04:00
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/assign_parent$",
assign_parent,
name="assign_parent",
),
2023-06-12 15:07:55 -04:00
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/remove_unused_seasons$",
remove_unused_seasons,
name="remove_unused_seasons",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/fetch_tvepisodes$",
fetch_tvepisodes,
name="fetch_tvepisodes",
),
2023-05-13 15:11:05 -04:00
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/merge$",
merge,
name="merge",
),
2023-01-23 21:24:31 -05:00
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/recast$",
recast,
name="recast",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/comments_by_episode$",
comments_by_episode,
name="comments_by_episode",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/comments$",
comments,
name="comments",
),
2022-12-29 23:57:02 -05:00
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/reviews",
reviews,
name="reviews",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/review_list",
2022-12-29 23:57:02 -05:00
review_list,
name="review_list",
),
re_path(
r"^(?P<item_path>"
+ _get_all_url_paths()
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/marks(?:/(?P<following_only>\\w+))?",
mark_list,
name="mark_list",
),
2023-07-20 21:59:49 -04:00
path("search", search, name="search"),
path("search/", search, name="search_legacy"),
path("search/external", external_search, name="external_search"),
2022-12-31 11:06:23 -05:00
path("fetch_refresh/<str:job_id>", fetch_refresh, name="fetch_refresh"),
2023-01-05 03:06:13 -05:00
path("refetch", refetch, name="refetch"),
2023-01-23 16:31:30 -05:00
path("unlink", unlink, name="unlink"),
2023-04-19 22:31:27 -04:00
path("discover/", discover, name="discover"),
]