mirror of
https://github.com/aljazceru/cryptoanarchywiki.github.io.git
synced 2025-12-17 05:04:21 +01:00
Add post
This commit is contained in:
@@ -18,11 +18,11 @@ class UserRedirectView(RedirectView):
|
|||||||
permanent = False
|
permanent = False
|
||||||
def get_redirect_url(self, pk):
|
def get_redirect_url(self, pk):
|
||||||
pk = ''.join(str(pk).split('/'))
|
pk = ''.join(str(pk).split('/'))
|
||||||
return reverse('pool_fix', kwargs={'pk': pk})
|
return reverse('pool_fix_page', kwargs={'pk': pk})
|
||||||
|
|
||||||
def pool_fix(request, pk):
|
def pool_fix(request, pk):
|
||||||
return HttpResponse("You're looking at question %s." % pk)
|
return HttpResponse("You're looking at question %s." % pk)
|
||||||
|
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
#### 2. In your `urls.py`
|
#### 2. In your `urls.py`
|
||||||
@@ -32,7 +32,10 @@ from django.conf.urls import url
|
|||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
# first view the pool to doing redirection
|
||||||
url(r'^pool/(?P<pk>[0-9a-zA-Z\/]+)/$', views.UserRedirectView.as_view(), name='pool'),
|
url(r'^pool/(?P<pk>[0-9a-zA-Z\/]+)/$', views.UserRedirectView.as_view(), name='pool'),
|
||||||
url(r'^pool/(?P<pk>[\d\w_]+)$', views.pool_fix, name='pool_fix'), #allow decimal and words only.
|
|
||||||
|
# allow decimal and words only.
|
||||||
|
url(r'^pool/(?P<pk>[\d\w_]+)$', views.pool_fix, name='pool_fix_page'),
|
||||||
]
|
]
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|||||||
Reference in New Issue
Block a user