From 89a066da0bd3631f163781fc8ff549d3c4d947cd Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Thu, 3 Oct 2024 18:25:20 -0700 Subject: [PATCH] remove django-url-tools in favor of core_tags snippet --- archivebox/core/settings.py | 2 -- archivebox/core/templatetags/core_tags.py | 6 +++++ archivebox/templates/core/public_index.html | 29 +++++++++++---------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/archivebox/core/settings.py b/archivebox/core/settings.py index 460a17a6..7be4f3e6 100644 --- a/archivebox/core/settings.py +++ b/archivebox/core/settings.py @@ -99,7 +99,6 @@ INSTALLED_APPS = [ 'django_jsonform', # handles rendering Pydantic models to Django HTML widgets/forms https://github.com/bhch/django-jsonform 'signal_webhooks', # handles REST API outbound webhooks https://github.com/MrThearMan/django-signal-webhooks 'django_object_actions', # provides easy Django Admin action buttons on change views https://github.com/crccheck/django-object-actions - 'url_tools', # adds template tags to append/toggle URL parameters https://bitbucket.org/monwara/django-url-tools # Our ArchiveBox-provided apps #'config', # ArchiveBox config settings (loaded as a plugin, don't need to add it here) @@ -204,7 +203,6 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', - 'url_tools.context_processors.current_url', ], }, }, diff --git a/archivebox/core/templatetags/core_tags.py b/archivebox/core/templatetags/core_tags.py index 4f53ac2a..2de610bc 100644 --- a/archivebox/core/templatetags/core_tags.py +++ b/archivebox/core/templatetags/core_tags.py @@ -38,3 +38,9 @@ def result_list_tag(parser, token): template_name='snapshots_grid.html', takes_context=False, ) + +@register.simple_tag(takes_context=True) +def url_replace(context, **kwargs): + dict_ = context['request'].GET.copy() + dict_.update(**kwargs) + return dict_.urlencode() diff --git a/archivebox/templates/core/public_index.html b/archivebox/templates/core/public_index.html index e9655b92..ab7fe3e1 100644 --- a/archivebox/templates/core/public_index.html +++ b/archivebox/templates/core/public_index.html @@ -1,26 +1,27 @@ {% extends "base.html" %} {% load static tz %} +{% load core_tags %} {% block body %}
-