Example #1
0
"""codingent URL Configuration

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 django.contrib import admin
from django.views.generic import TemplateView

from restaurants.views import HomeView, RestaurantListView, RestaurantDetailView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', HomeView.as_view()),
    url(r'^about', TemplateView.as_view(template_name='about.html')),
    url(r'^contact', TemplateView.as_view(template_name='contact.html')),
    url(r'^restaurants/$', RestaurantListView.as_view()),
    # url(r'^restaurants/(?P<slug>\w+)/$', RestaurantListView.as_view()),
    url(r'^restaurants/(?P<pk>\d+)/$', RestaurantDetailView.as_view()),
]
Example #2
0
#                                # SearchRestaurantListView,
#                                MalaysianListView,
#                                RestaurantDetailView,
#                                RestaurantCreateView)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^restaurants/', include('restaurants.urls',
                                  namespace='restaurants')),
    url(r'^menus/', include('menus.urls', namespace='menus')),
    url(r'^profiles/', include('profiles.urls', namespace='profile')),
    # url(r'^$', home, name='home'),
    # url(r'^about/$', about, name='about'),
    # url(r'^contact/$', contact, name='contact'),
    # url(r'^contact/$', ContactView.as_view(), name='contact'),
    url(r'^$', HomeView.as_view(), name='home'),
    url(r'^about/$', AboutView.as_view(), name='about'),
    url(r'^contact/$', ContactView.as_view(), name='contact'),
    url(
        r'^login/$',
        LoginView.as_view(),
        name='login',
    ),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),
    url(r'^password-reset/$', PasswordResetView.as_view(), name='reset'),
    # # url(r'^restaurants/$', restaurant_listview, name='restaurants_list'),
    # url(r'^restaurants/$', RestaurantListView.as_view(), name='restaurants_list'),
    # url(r'^restaurants/create/$', RestaurantCreateView.as_view(), name='create'),
    # # url(r'^restaurants/create/$', restaurant_createview, name='create'),
    # # url(r'^restaurants/(?P<slug>\w+)/$', RestaurantListView.as_view()),
    # # url(r'^restaurants/(?P<slug>\w+)/$', SearchRestaurantListView.as_view()),
Example #3
0
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 django.contrib import admin
#from restaurants.views import home,information,about,AboutView,AboutTemplateView
#from restaurants.views import HomeView,InformationView,AboutTemplateView,AboutView
from restaurants.views import HomeView, AboutView
from django.views.generic import TemplateView
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    #url(r'^$', home),
    #url(r'^information/$', information),
    #url(r'^about/$', about),
    #------------------------------------
    url(r'^$', HomeView.as_view()),  #TemplateView
    #url(r'^information/$', InformationView.as_view()),          #TemplateView
    #url(r'^about/$', AboutTemplateView.as_view()),             #TemplateView
    url(r'^information/$',
        TemplateView.as_view(template_name='information.html')),  #TemplateView
    url(r'^about/$', TemplateView.as_view(template_name='about.html')),
    url(r'^about/(?P<id>\d+)/$', AboutView.as_view()),  #Class-based-View
]