summaryrefslogtreecommitdiff
path: root/app/links
diff options
context:
space:
mode:
Diffstat (limited to 'app/links')
-rw-r--r--app/links/urls.py32
-rw-r--r--app/links/views.py3
2 files changed, 19 insertions, 16 deletions
diff --git a/app/links/urls.py b/app/links/urls.py
index 6f9bf22..792a5ea 100644
--- a/app/links/urls.py
+++ b/app/links/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls import url
+from django.urls import path, re_path
from django.views.generic.base import RedirectView
from . import views
@@ -6,34 +6,36 @@ from . import views
app_name = "links"
urlpatterns = [
- url(
+ re_path(
+ r'^tag/(?P<slug>[-\w]+)/$',
+ views.LinkTagListView.as_view(),
+ {'page':1},
+ name='list-tag'
+ ),
+ re_path(
r'tag/(?P<slug>[-\w]+)/(?P<page>\d+)/$',
views.LinkTagListView.as_view(),
name='list-tag'
),
- url(
+ re_path(
r'(?P<slug>[-\d]+).txt$',
views.LinkDetailViewTXT.as_view(),
name="detail-txt"
),
- url(
- r'(?P<slug>[-\d]+)$',
+ path(
+ r'<int:slug>',
views.LinkDetailView.as_view(),
name='detail'
),
- url(
+ re_path(
r'(?P<page>\d+)/$',
views.LinkListView.as_view(),
name='list'
),
- url(
- r'^tag/(?P<slug>[-\w]+)/$',
- RedirectView.as_view(url="/links/tag/%(slug)s/1/", permanent=False),
- name="live-redirect-tag"
- ),
- url(
- r'^$',
- RedirectView.as_view(url="/links/1/", permanent=False),
- name="live-redirect"
+ path(
+ r'',
+ views.LinkListView.as_view(),
+ {'page':1},
+ name='list'
),
]
diff --git a/app/links/views.py b/app/links/views.py
index 2c74509..ebde61c 100644
--- a/app/links/views.py
+++ b/app/links/views.py
@@ -19,7 +19,8 @@ class LinkTagListView(PaginatedListView):
template_name = 'archives/links.html'
def get_queryset(self):
- return Link.objects.filter(tags__name=self.kwargs['slug'])
+ print(self.kwargs['slug'])
+ return Link.objects.filter(tags__slug=self.kwargs['slug'])
def get_context_data(self, **kwargs):
# Call the base implementation first to get a context