Merge branch 'rearrange_urls' into 'master'

Rearrange the urls

See merge request !8
This commit is contained in:
Tyrel Souza 2017-04-01 20:13:18 +00:00
commit 4840445504
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'))