mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
use proper url naming instead of hardcoding paths
This commit is contained in:
parent
b8c8c4a599
commit
d70bb7980e
5 changed files with 42 additions and 22 deletions
|
@ -6,7 +6,7 @@ from contextlib import redirect_stdout
|
|||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.utils.html import format_html
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
from core.models import Snapshot
|
||||
|
@ -103,10 +103,13 @@ class ArchiveBoxAdmin(admin.AdminSite):
|
|||
|
||||
def get_urls(self):
|
||||
return [
|
||||
path('core/snapshot/add/', self.add_view, name='add'),
|
||||
path('core/snapshot/add/', self.add_view, name='Add'),
|
||||
] + super().get_urls()
|
||||
|
||||
def add_view(self, request):
|
||||
if not request.user.is_authenticated:
|
||||
return redirect(f'/admin/login/?next={request.path}')
|
||||
|
||||
request.current_app = self.name
|
||||
context = {
|
||||
**self.each_context(request),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue