simplify view import
This commit is contained in:
parent
3f96b37b51
commit
11a61a06a6
|
@ -1,144 +1,119 @@
|
||||||
"""all api urls"""
|
"""all api urls"""
|
||||||
|
|
||||||
from api.views import (
|
from api import views
|
||||||
ChannelApiListView,
|
|
||||||
ChannelApiVideoView,
|
|
||||||
ChannelApiView,
|
|
||||||
CookieView,
|
|
||||||
DownloadApiListView,
|
|
||||||
DownloadApiView,
|
|
||||||
LoginApiView,
|
|
||||||
NotificationView,
|
|
||||||
PingView,
|
|
||||||
PlaylistApiListView,
|
|
||||||
PlaylistApiVideoView,
|
|
||||||
PlaylistApiView,
|
|
||||||
RefreshView,
|
|
||||||
SearchView,
|
|
||||||
SnapshotApiListView,
|
|
||||||
SnapshotApiView,
|
|
||||||
TaskApiView,
|
|
||||||
VideoApiListView,
|
|
||||||
VideoApiView,
|
|
||||||
VideoCommentView,
|
|
||||||
VideoProgressView,
|
|
||||||
VideoSimilarView,
|
|
||||||
VideoSponsorView,
|
|
||||||
WatchedView,
|
|
||||||
)
|
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("ping/", PingView.as_view(), name="ping"),
|
path("ping/", views.PingView.as_view(), name="ping"),
|
||||||
path("login/", LoginApiView.as_view(), name="api-login"),
|
path("login/", views.LoginApiView.as_view(), name="api-login"),
|
||||||
path(
|
path(
|
||||||
"video/",
|
"video/",
|
||||||
VideoApiListView.as_view(),
|
views.VideoApiListView.as_view(),
|
||||||
name="api-video-list",
|
name="api-video-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"video/<slug:video_id>/",
|
"video/<slug:video_id>/",
|
||||||
VideoApiView.as_view(),
|
views.VideoApiView.as_view(),
|
||||||
name="api-video",
|
name="api-video",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"video/<slug:video_id>/progress/",
|
"video/<slug:video_id>/progress/",
|
||||||
VideoProgressView.as_view(),
|
views.VideoProgressView.as_view(),
|
||||||
name="api-video-progress",
|
name="api-video-progress",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"video/<slug:video_id>/comment/",
|
"video/<slug:video_id>/comment/",
|
||||||
VideoCommentView.as_view(),
|
views.VideoCommentView.as_view(),
|
||||||
name="api-video-comment",
|
name="api-video-comment",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"video/<slug:video_id>/similar/",
|
"video/<slug:video_id>/similar/",
|
||||||
VideoSimilarView.as_view(),
|
views.VideoSimilarView.as_view(),
|
||||||
name="api-video-similar",
|
name="api-video-similar",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"video/<slug:video_id>/sponsor/",
|
"video/<slug:video_id>/sponsor/",
|
||||||
VideoSponsorView.as_view(),
|
views.VideoSponsorView.as_view(),
|
||||||
name="api-video-sponsor",
|
name="api-video-sponsor",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"channel/",
|
"channel/",
|
||||||
ChannelApiListView.as_view(),
|
views.ChannelApiListView.as_view(),
|
||||||
name="api-channel-list",
|
name="api-channel-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"channel/<slug:channel_id>/",
|
"channel/<slug:channel_id>/",
|
||||||
ChannelApiView.as_view(),
|
views.ChannelApiView.as_view(),
|
||||||
name="api-channel",
|
name="api-channel",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"channel/<slug:channel_id>/video/",
|
"channel/<slug:channel_id>/video/",
|
||||||
ChannelApiVideoView.as_view(),
|
views.ChannelApiVideoView.as_view(),
|
||||||
name="api-channel-video",
|
name="api-channel-video",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"playlist/",
|
"playlist/",
|
||||||
PlaylistApiListView.as_view(),
|
views.PlaylistApiListView.as_view(),
|
||||||
name="api-playlist-list",
|
name="api-playlist-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"playlist/<slug:playlist_id>/",
|
"playlist/<slug:playlist_id>/",
|
||||||
PlaylistApiView.as_view(),
|
views.PlaylistApiView.as_view(),
|
||||||
name="api-playlist",
|
name="api-playlist",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"playlist/<slug:playlist_id>/video/",
|
"playlist/<slug:playlist_id>/video/",
|
||||||
PlaylistApiVideoView.as_view(),
|
views.PlaylistApiVideoView.as_view(),
|
||||||
name="api-playlist-video",
|
name="api-playlist-video",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"download/",
|
"download/",
|
||||||
DownloadApiListView.as_view(),
|
views.DownloadApiListView.as_view(),
|
||||||
name="api-download-list",
|
name="api-download-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"download/<slug:video_id>/",
|
"download/<slug:video_id>/",
|
||||||
DownloadApiView.as_view(),
|
views.DownloadApiView.as_view(),
|
||||||
name="api-download",
|
name="api-download",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"refresh/",
|
"refresh/",
|
||||||
RefreshView.as_view(),
|
views.RefreshView.as_view(),
|
||||||
name="api-refresh",
|
name="api-refresh",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"task/",
|
"task/",
|
||||||
TaskApiView.as_view(),
|
views.TaskApiView.as_view(),
|
||||||
name="api-task",
|
name="api-task",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"snapshot/",
|
"snapshot/",
|
||||||
SnapshotApiListView.as_view(),
|
views.SnapshotApiListView.as_view(),
|
||||||
name="api-snapshot-list",
|
name="api-snapshot-list",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"snapshot/<slug:snapshot_id>/",
|
"snapshot/<slug:snapshot_id>/",
|
||||||
SnapshotApiView.as_view(),
|
views.SnapshotApiView.as_view(),
|
||||||
name="api-snapshot",
|
name="api-snapshot",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"cookie/",
|
"cookie/",
|
||||||
CookieView.as_view(),
|
views.CookieView.as_view(),
|
||||||
name="api-cookie",
|
name="api-cookie",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"watched/",
|
"watched/",
|
||||||
WatchedView.as_view(),
|
views.WatchedView.as_view(),
|
||||||
name="api-watched",
|
name="api-watched",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"search/",
|
"search/",
|
||||||
SearchView.as_view(),
|
views.SearchView.as_view(),
|
||||||
name="api-search",
|
name="api-search",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"notification/",
|
"notification/",
|
||||||
NotificationView.as_view(),
|
views.NotificationView.as_view(),
|
||||||
name="api-notification",
|
name="api-notification",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,78 +4,73 @@ from django.conf import settings
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth.views import LogoutView
|
from django.contrib.auth.views import LogoutView
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from home.views import (
|
from home import views
|
||||||
AboutView,
|
|
||||||
ChannelIdAboutView,
|
|
||||||
ChannelIdLiveView,
|
|
||||||
ChannelIdPlaylistView,
|
|
||||||
ChannelIdShortsView,
|
|
||||||
ChannelIdView,
|
|
||||||
ChannelView,
|
|
||||||
DownloadView,
|
|
||||||
HomeView,
|
|
||||||
LoginView,
|
|
||||||
PlaylistIdView,
|
|
||||||
PlaylistView,
|
|
||||||
SearchView,
|
|
||||||
SettingsView,
|
|
||||||
VideoView,
|
|
||||||
process,
|
|
||||||
progress,
|
|
||||||
)
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", login_required(HomeView.as_view()), name="home"),
|
path("", login_required(views.HomeView.as_view()), name="home"),
|
||||||
path("login/", LoginView.as_view(), name="login"),
|
path("login/", views.LoginView.as_view(), name="login"),
|
||||||
path(
|
path(
|
||||||
"logout/",
|
"logout/",
|
||||||
LogoutView.as_view(),
|
LogoutView.as_view(),
|
||||||
{"next_page": settings.LOGOUT_REDIRECT_URL},
|
{"next_page": settings.LOGOUT_REDIRECT_URL},
|
||||||
name="logout",
|
name="logout",
|
||||||
),
|
),
|
||||||
path("about/", AboutView.as_view(), name="about"),
|
path("about/", views.AboutView.as_view(), name="about"),
|
||||||
path(
|
path(
|
||||||
"downloads/", login_required(DownloadView.as_view()), name="downloads"
|
"downloads/",
|
||||||
|
login_required(views.DownloadView.as_view()),
|
||||||
|
name="downloads",
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
"settings/",
|
||||||
|
login_required(views.SettingsView.as_view()),
|
||||||
|
name="settings",
|
||||||
|
),
|
||||||
|
path("process/", login_required(views.process), name="process"),
|
||||||
|
path(
|
||||||
|
"channel/",
|
||||||
|
login_required(views.ChannelView.as_view()),
|
||||||
|
name="channel",
|
||||||
),
|
),
|
||||||
path("settings/", login_required(SettingsView.as_view()), name="settings"),
|
|
||||||
path("process/", login_required(process), name="process"),
|
|
||||||
path("progress/", login_required(progress), name="progress"),
|
|
||||||
path("channel/", login_required(ChannelView.as_view()), name="channel"),
|
|
||||||
path(
|
path(
|
||||||
"channel/<slug:channel_id>/",
|
"channel/<slug:channel_id>/",
|
||||||
login_required(ChannelIdView.as_view()),
|
login_required(views.ChannelIdView.as_view()),
|
||||||
name="channel_id",
|
name="channel_id",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"channel/<slug:channel_id>/streams/",
|
"channel/<slug:channel_id>/streams/",
|
||||||
login_required(ChannelIdLiveView.as_view()),
|
login_required(views.ChannelIdLiveView.as_view()),
|
||||||
name="channel_id_live",
|
name="channel_id_live",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"channel/<slug:channel_id>/shorts/",
|
"channel/<slug:channel_id>/shorts/",
|
||||||
login_required(ChannelIdShortsView.as_view()),
|
login_required(views.ChannelIdShortsView.as_view()),
|
||||||
name="channel_id_shorts",
|
name="channel_id_shorts",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"channel/<slug:channel_id>/about/",
|
"channel/<slug:channel_id>/about/",
|
||||||
login_required(ChannelIdAboutView.as_view()),
|
login_required(views.ChannelIdAboutView.as_view()),
|
||||||
name="channel_id_about",
|
name="channel_id_about",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"channel/<slug:channel_id>/playlist/",
|
"channel/<slug:channel_id>/playlist/",
|
||||||
login_required(ChannelIdPlaylistView.as_view()),
|
login_required(views.ChannelIdPlaylistView.as_view()),
|
||||||
name="channel_id_playlist",
|
name="channel_id_playlist",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"video/<slug:video_id>/",
|
"video/<slug:video_id>/",
|
||||||
login_required(VideoView.as_view()),
|
login_required(views.VideoView.as_view()),
|
||||||
name="video",
|
name="video",
|
||||||
),
|
),
|
||||||
path("playlist/", login_required(PlaylistView.as_view()), name="playlist"),
|
path(
|
||||||
|
"playlist/",
|
||||||
|
login_required(views.PlaylistView.as_view()),
|
||||||
|
name="playlist",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"playlist/<slug:playlist_id>/",
|
"playlist/<slug:playlist_id>/",
|
||||||
login_required(PlaylistIdView.as_view()),
|
login_required(views.PlaylistIdView.as_view()),
|
||||||
name="playlist_id",
|
name="playlist_id",
|
||||||
),
|
),
|
||||||
path("search/", login_required(SearchView.as_view()), name="search"),
|
path("search/", login_required(views.SearchView.as_view()), name="search"),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue