diff --git a/leftists/templates/interface/linkedlist.html b/leftists/templates/interface/linkedlist.html
new file mode 100644
index 0000000..7e229cd
--- /dev/null
+++ b/leftists/templates/interface/linkedlist.html
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+
+{% block main %}
+
+
+ |
+ link |
+ to |
+
+ {% for link in object_list %}
+
+ [e] | [d] |
+ {{ link.link }} |
+ {{ link.to }} |
+
+ {% endfor %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/leftists/templates/interface/overview.html b/leftists/templates/interface/overview.html
index c764ebc..90b2ed1 100644
--- a/leftists/templates/interface/overview.html
+++ b/leftists/templates/interface/overview.html
@@ -5,7 +5,7 @@
managing these domains:
{% for domain in domains %}
- - {{ domain.fqdn }}
+ - {{ domain.fqdn }}
{% endfor %}
diff --git a/leftists/urls.py b/leftists/urls.py
index a3c77eb..844c172 100644
--- a/leftists/urls.py
+++ b/leftists/urls.py
@@ -1,7 +1,7 @@
from django.urls import path
from leftists.views import ShortLinkRedirectView, CoolerLoginView, OverView, LinkCreateView, LinkUpdateView, \
- LinkDeleteView
+ LinkDeleteView, LinkListView
urlpatterns = [
path('', CoolerLoginView.as_view(), name='login'),
@@ -9,5 +9,6 @@ urlpatterns = [
path('iface/link/create', LinkCreateView.as_view(), name='interface.link.create'),
path('iface/link/update/', LinkUpdateView.as_view(), name='interface.link.update'),
path('iface/link/delete/', LinkDeleteView.as_view(), name='interface.link.delete'),
+ path('iface//links', LinkListView.as_view(), name='interface.link.list'),
path('', ShortLinkRedirectView.as_view(), name='link-redirect'),
]
diff --git a/leftists/views.py b/leftists/views.py
index bba9b28..774d46c 100644
--- a/leftists/views.py
+++ b/leftists/views.py
@@ -2,8 +2,8 @@ from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import LoginView
from django.shortcuts import get_object_or_404
from django.urls import reverse_lazy
-from django.views.generic import RedirectView, TemplateView, CreateView, UpdateView, DeleteView
-from django_scopes import scopes_disabled
+from django.views.generic import RedirectView, TemplateView, CreateView, UpdateView, DeleteView, ListView
+from django_scopes import scopes_disabled, scope
from scopedsites.models import Domain
from leftists.forms import LinkForm
@@ -37,6 +37,17 @@ class OverView(LoginRequiredMixin, TemplateView):
return ctx
+class LinkListView(LoginRequiredMixin, ListView):
+ template_name = 'interface/linkedlist.html'
+ model = ShortLink
+
+ def get(self, request, *args, **kwargs):
+ with scopes_disabled():
+ d = Domain.objects.get(fqdn__contains=kwargs.get('domain'))
+ with scope(domain=d):
+ return super().get(request, *args, **kwargs)
+
+
class LinkCreateView(LoginRequiredMixin, CreateView):
template_name = 'interface/basic_form.html'
model = ShortLink