map legacy urls
This commit is contained in:
parent
b0bd670cec
commit
62ee15ec0b
3 changed files with 76 additions and 2 deletions
|
@ -29,6 +29,7 @@ urlpatterns = [
|
||||||
path("announcement/", include("management.urls")),
|
path("announcement/", include("management.urls")),
|
||||||
path("hijack/", include("hijack.urls")),
|
path("hijack/", include("hijack.urls")),
|
||||||
path("", include("common.urls")),
|
path("", include("common.urls")),
|
||||||
|
path("", include("legacy.urls")),
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns += [path(settings.ADMIN_URL + "-rq/", include("django_rq.urls"))]
|
urlpatterns += [path(settings.ADMIN_URL + "-rq/", include("django_rq.urls"))]
|
||||||
|
|
17
legacy/urls.py
Normal file
17
legacy/urls.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
from django.urls import path, re_path
|
||||||
|
from .views import *
|
||||||
|
|
||||||
|
app_name = "legacy"
|
||||||
|
urlpatterns = [
|
||||||
|
path("books/<int:id>/", book, name="book"),
|
||||||
|
path("movies/<int:id>/", movie, name="movie"),
|
||||||
|
path("music/album/<int:id>/", album, name="album"),
|
||||||
|
path("music/song/<int:id>/", song, name="song"),
|
||||||
|
path("games/<int:id>/", game, name="game"),
|
||||||
|
path("collections/<int:id>/", collection, name="collection"),
|
||||||
|
path("books/review/<int:id>/", book_review, name="book_review"),
|
||||||
|
path("movies/review/<int:id>/", movie_review, name="movie_review"),
|
||||||
|
path("music/album/review/<int:id>/", album_review, name="album_review"),
|
||||||
|
path("music/song/review/<int:id>/", song_review, name="song_review"),
|
||||||
|
path("games/review/<int:id>/", game_review, name="game_review"),
|
||||||
|
]
|
|
@ -1,3 +1,59 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import redirect, render, get_object_or_404
|
||||||
|
from .models import *
|
||||||
|
from catalog.models import Item
|
||||||
|
from django.utils.baseconv import base62
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
|
def book(request, id):
|
||||||
|
link = get_object_or_404(BookLink, old_id=id)
|
||||||
|
return redirect(f"/book/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def movie(request, id):
|
||||||
|
link = get_object_or_404(MovieLink, old_id=id)
|
||||||
|
return redirect(f"/movie/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def album(request, id):
|
||||||
|
link = get_object_or_404(MovieLink, old_id=id)
|
||||||
|
return redirect(f"/album/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def song(request, id):
|
||||||
|
link = get_object_or_404(MovieLink, old_id=id)
|
||||||
|
return redirect(f"/album/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def game(request, id):
|
||||||
|
link = get_object_or_404(MovieLink, old_id=id)
|
||||||
|
return redirect(f"/game/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def collection(request, id):
|
||||||
|
link = get_object_or_404(MovieLink, old_id=id)
|
||||||
|
return redirect(f"/collection/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def book_review(request, id):
|
||||||
|
link = get_object_or_404(ReviewLink, module="book", old_id=id)
|
||||||
|
return redirect(f"/review/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def movie_review(request, id):
|
||||||
|
link = get_object_or_404(ReviewLink, module="movie", old_id=id)
|
||||||
|
return redirect(f"/review/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def album_review(request, id):
|
||||||
|
link = get_object_or_404(ReviewLink, module="album", old_id=id)
|
||||||
|
return redirect(f"/review/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def song_review(request, id):
|
||||||
|
link = get_object_or_404(ReviewLink, module="song", old_id=id)
|
||||||
|
return redirect(f"/review/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
||||||
|
|
||||||
|
def game_review(request, id):
|
||||||
|
link = get_object_or_404(ReviewLink, module="game", old_id=id)
|
||||||
|
return redirect(f"/review/{base62.encode(link.new_uid.int)}")
|
||||||
|
|
Loading…
Add table
Reference in a new issue