Rearrange the urls

This commit is contained in:
Tyrel Souza 2017-04-01 16:12:50 -04:00
parent e57e0100ea
commit 550f3ce59c
No known key found for this signature in database
GPG Key ID: 2EECB5087209E6A5
3 changed files with 10 additions and 4 deletions

View File

@ -5,5 +5,5 @@ from machines.routers import router
urlpatterns = [
url(r'^api/', include(router.urls)),
url(r'^(?P<pk>\w+)/$', MachineDetail.as_view(), name='machine-detail'),
url(r'^$', MachineList.as_view()),
url(r'^$', MachineList.as_view(), name='machines-list'),
]

View File

@ -1,9 +1,9 @@
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
from stagestatus.views import redirect_machines
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^machines/', include('machines.urls')),
url(r'^', TemplateView.as_view(template_name='index.html')),
url(r'machines/', include('machines.urls')),
url(r'', redirect_machines),
]

6
stagestatus/views.py Normal file
View File

@ -0,0 +1,6 @@
from django.http import HttpResponseRedirect
from django.shortcuts import reverse
def redirect_machines(request):
return HttpResponseRedirect(reverse('machines-list'))