handle common url typos
This commit is contained in:
parent
8cb7f78c30
commit
f5e0f94e74
3 changed files with 13 additions and 0 deletions
|
@ -36,6 +36,13 @@ urlpatterns = [
|
|||
retrieve,
|
||||
name="retrieve",
|
||||
),
|
||||
re_path(
|
||||
r"^(?P<item_path>"
|
||||
+ _get_all_url_paths()
|
||||
+ ")/(?P<item_uuid>[A-Za-z0-9]{21,22})/$",
|
||||
retrieve_redirect,
|
||||
name="retrieve_redirect",
|
||||
),
|
||||
path("podcast/<str:item_uuid>/episodes", episode_data, name="episode_data"),
|
||||
path("catalog/create/<str:item_model>", create, name="create"),
|
||||
re_path(
|
||||
|
|
|
@ -42,6 +42,10 @@ def retrieve_by_uuid(request, item_uid):
|
|||
return redirect(item.url)
|
||||
|
||||
|
||||
def retrieve_redirect(request, item_path, item_uuid):
|
||||
return redirect(f"/{item_path}/{item_uuid}")
|
||||
|
||||
|
||||
@xframe_options_exempt
|
||||
def embed(request, item_path, item_uuid):
|
||||
if request.method != "GET":
|
||||
|
|
|
@ -5,6 +5,7 @@ from django.core.exceptions import BadRequest, ObjectDoesNotExist, PermissionDen
|
|||
from django.http import Http404, HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from user_messages import api as msg
|
||||
|
||||
from catalog.models import *
|
||||
|
@ -17,6 +18,7 @@ from ..models import *
|
|||
from .common import render_list, target_identity_required
|
||||
|
||||
|
||||
@require_http_methods(["GET"])
|
||||
@target_identity_required
|
||||
def profile(request: AuthedHttpRequest, user_name):
|
||||
if request.method != "GET":
|
||||
|
|
Loading…
Add table
Reference in a new issue