from django.urls import path from countries.views import (CountryDetailView, CountryDetailIDView, CountrySearchView) app_name = 'countries' urlpatterns = [ path("search/<query>", CountrySearchView.as_view(), name="country_search"), path("<int:pk>/", CountryDetailIDView.as_view(), name="country_id_detail"), path("<code>/", CountryDetailView.as_view(), name="country_code_detail") ]
from django.urls import path from countries.views import ( HomeView, TagsView, CountryDetailView, CountrySearchView, ) app_name = 'countries' urlpatterns = [ path('', HomeView.as_view(), name='home'), path('tags/', TagsView.as_view(), name='tags'), path('<str:code>/', CountryDetailView.as_view(), name='country_detail_code'), path('search/<query>/', CountrySearchView.as_view(), name='country_search') ]
The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from countries.views import CountryDetailView, CountryDetailIdView, CountrySearchView, HomeView, CreateCountryView urlpatterns = [ url(r'^register/', CreateCountryView.as_view(), name="country_register"), url(r'^search/(?P<pk>.*)/$', CountrySearchView.as_view(), name="country_search"), url(r'^(?P<pk>\d+)/$', CountryDetailIdView.as_view(), name="country_id_detail"), url(r'^(?P<code>.*)/$', CountryDetailView.as_view(), name="country_code_detail"), url(r'', HomeView.as_view(), name="country_home") ]
from django.conf.urls import patterns, url from countries.views import CountryDetailView urlpatterns = patterns('', url(r'^countries/(?P<slug>[\w-]+)/$', CountryDetailView.as_view()), )
from django.contrib import admin from django.urls import path, include # from django.views.generic import TemplateView from countries.views import (CountryDetailView, CountryDetailIdView, CountrySearchView) app_name = 'countries' urlpatterns = [ path('search/<query>/', CountrySearchView.as_view(), name='country_search'), path('<int:pk>/', CountryDetailIdView.as_view(), name='id_detail'), path('<code>/', CountryDetailView.as_view(), name='detail'), ]
"""geographic URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from countries.views import HomeView, TagsView, CountryDetailView,CountryDetailIDView from continents.views import ContinentsView urlpatterns = [ path('admin/', admin.site.urls), path('', HomeView.as_view(), name="home"), path('tags/', TagsView.as_view(), name="tags"), path('continents/', ContinentsView.as_view(), name="continents_home"), path('countries/<int:id>/', CountryDetailIDView.as_view(), name="country_id_detail"), path('countries/<code>/', CountryDetailView.as_view(), name="country_code_detail") ]