Ejemplo n.º 1
0
 def test_restaurants_list(self):
     request = self.factory.get("restaurant/restaurants/all/")
     view = RestaurantListView()
     view.setup(request)
     restaurants = view.get_context_data()['restaurant']
     for restaurant in restaurants:
         if restaurant.logo:
             self.assertTrue(isinstance(restaurant.logo.url, str))
Ejemplo n.º 2
0
    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 (restaurant_listview, RestaurantListView,
                               RestaurantDetailView, restaurant_createview)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TemplateView.as_view(template_name='home.html')),
    url(r'^restaurants/$', RestaurantListView.as_view()),
    url(r'^restaurants/create/$', restaurant_createview),
    # url(r'^restaurants/(?P<slug>\w+)/$', RestaurantListView.as_view()),
    url(r'^restaurants/(?P<slug>[\w-]+)/$', RestaurantDetailView.as_view()),
    # url(r'^restaurants/asian/$', AsianFusionRestaurantListView.as_view()),
    url(r'^about/$', TemplateView.as_view(template_name='about.html')),
    url(r'^contact/$', TemplateView.as_view(template_name='contact.html')),
]
Ejemplo n.º 3
0
from django.conf.urls import url

from restaurants.views import (
    RestaurantListView,
    RestaurantDetailView,
    RestaurantLocationCreateView,
)

urlpatterns = [
    url(r'^$', RestaurantListView.as_view(), name='list'),
    url(r'^create/$', RestaurantLocationCreateView.as_view(), name='create'),
    url(r'^(?P<slug>[\w-]+)/$', RestaurantDetailView.as_view(), name='detail'),
]
Ejemplo n.º 4
0
    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 (
    restaurants_listview,
    RestaurantListView,
)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', TemplateView.as_view(template_name="home.html")),
    url(r'^restaurants$', RestaurantListView.as_view()),
    url(r'^restaurants/(?P<slug>\w+)/$', RestaurantListView.as_view()),
    # url(r'^restaurants/asian$', AsianFusionRestaurantListView.as_view()),
    url(r'^about$', TemplateView.as_view(template_name="about.html")),
    url(r'^contact$', TemplateView.as_view(template_name="contact.html")),
]
Ejemplo n.º 5
0
from django.urls import path, re_path

from restaurants.views import (
    RestaurantListView,
    RestaurantDetailView,
    RestaurantCreatView,
    RestaurantUpdateView,

    #  MexicanRestaurantListView,
    # AsianFusionRestaurantListView,
)

urlpatterns = [
    path('', RestaurantListView.as_view(), name='list'),
    path('create/', RestaurantCreatView.as_view(), name='create'),
    #re_path('(?P<slug>[\w-]+)/edit/$', RestaurantUpdateView.as_view(), name='edit'),
    re_path('(?P<slug>[\w-]+)/$',
            RestaurantUpdateView.as_view(),
            name='detail'),
]
"""
 path('restaurants/create', restaurant_createview), 
    # re_path(r'^restaurants/(?P<slug>\w+)/$', RestaurantListView.as_view()),
   path('restaurants/asian/', AsianFusionRestaurantListView.as_view()), 

"""
Ejemplo n.º 6
0
Archivo: urls.py Proyecto: rafen/resto
from django.conf.urls import patterns, include, url
from django.contrib import admin
from restaurants.views import RestaurantListView


urlpatterns = patterns('',
    url(r'^$', RestaurantListView.as_view(), name='index'),
    url(r'^restaurants/', include('restaurants.urls')),

	url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^api-docs/', include('rest_framework_swagger.urls')),
    url(r'^admin/', include(admin.site.urls)),
)
Ejemplo n.º 7
0
"""Learning 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 restaurants.views import home, RestaurantNames, RestaurantListView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', home),
    url(r'^restaurants/$', RestaurantNames.as_view()),
    url(r'^restaurants/(?P<avi>\w+)/$', RestaurantListView.as_view())
]
Ejemplo n.º 8
0
    restaurant_createview,
    restaurant_listview,
    RestaurantListView,
    RestaurantDetailView,
    RestaurantCreateView,
)

urlpatterns = [
    url(r'^admin/', admin.site.urls),

    # The only reason we are using 'HomeView' here is, we are customizing
    # the get_context_data in views.py if not we would use TemplateView.as_view()
    # url(r'^$', HomeView.as_view()),
    url(r'^$', TemplateView.as_view(template_name="home.html"), name="home"),
    url(r'^login/$', LoginView.as_view(), name="login"),
    url(r'^restaurants/$', RestaurantListView.as_view(), name="restaurants"),
    url(r'^restaurants/create/$',
        RestaurantCreateView.as_view(),
        name="restaurants-create"),
    #url(r'^restaurants/create/$', restaurant_createview),
    url(r'^restaurants/(?P<slug>[\w-]+)/$',
        RestaurantDetailView.as_view(),
        name="restaurant-detail"),
    #url(r'^restaurants/(?P<slug>\w+)/$', RestaurantListView.as_view()),
    #url(r'^restaurants/asian/$', AsianFusionRestaurantListView.as_view()),
    url(r'^about/$',
        TemplateView.as_view(template_name="about.html"),
        name="about"),
    url(r'^contact/$',
        TemplateView.as_view(template_name="contact.html"),
        name="contact"),
Ejemplo n.º 9
0
from django.urls import path

from restaurants.views import RestaurantListView, RestaurantCreateView, RestaurantUpdateView

app_name = 'restaurants'

urlpatterns = [
    path('', RestaurantListView.as_view(), name="list"),
    path('create/', RestaurantCreateView.as_view(), name="create"),
    path('<slug:slug>/', RestaurantUpdateView.as_view(), name="detail")
]
Ejemplo n.º 10
0
from django.urls import path

from restaurants.views import (
    RestaurantListView,
    RestaurantDetailView,
    RestaurantCreateView
)

app_name = 'restaurants'

urlpatterns = [
    path('create/', RestaurantCreateView.as_view(), name='create'),
    path('', RestaurantListView.as_view(), name='list'),
    path('search/<slug:search>/', RestaurantListView.as_view(), name='search'),
    # path('restaurants/<int:id>/', RestaurantDetailView.as_view()), # use custom id
    # path('restaurants/<int:pk>/', RestaurantDetailView.as_view()), # use pk
    path('<slug:slug>/', RestaurantDetailView.as_view(), name='detail')
]
Ejemplo n.º 11
0
from restaurants.views import RestaurantListView, CreateRestaurantView, CreateContractView, ContractListView
from django.views.generic.base import TemplateView
from django.conf.urls import patterns, url

urlpatterns = patterns(
    '',
    url(r'^restaurants/new/$',
        CreateRestaurantView.as_view(),
        name='create_restaurant'),
    url(r'^restaurants/$',
        RestaurantListView.as_view(),
        name='restaurant_list'),
    url(r'^contracts/new/$',
        CreateContractView.as_view(),
        name='create_contract'),
    url(r'^contracts/$', ContractListView.as_view(), name='contract_list'),
    url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),
)
Ejemplo n.º 12
0
from django.conf.urls import url

from restaurants.views import (RestaurantListView, RestaurantDetailView,
                               RestaurantLocationCreateView,
                               RestaurantLocationDeleteView,
                               RestaurantLocationUpdateView)

urlpatterns = [
    url(r'^$', RestaurantListView.as_view(), name="list"),
    url(r'^create/$', RestaurantLocationCreateView.as_view(), name="create"),
    url(r'^(?P<slug>[\w-]+)/update/$',
        RestaurantLocationUpdateView.as_view(),
        name="update"),
    url(r'^(?P<slug>[\w-]+)/$', RestaurantDetailView.as_view(), name="detail"),
]
Ejemplo n.º 13
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from restaurants.views import RestaurantListView


urlpatterns = patterns(
    "",
    url(r"^$", RestaurantListView.as_view(), name="index"),
    url(r"^restaurants/", include("restaurants.urls")),
    url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")),
    url(r"^api-docs/", include("rest_framework_swagger.urls")),
    url(r"^admin/", include(admin.site.urls)),
)
Ejemplo n.º 14
0
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include
from django.urls import path, re_path
from restaurants.views import restaurant_createview, \
    RestaurantListView, \
    RestaurantDetailView, \
    RestaurantCreateView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', restaurant_createview, name="home"),
    path('restaurants/', RestaurantListView.as_view(), name="restaurant_page"),
    path('restaurants/create/', RestaurantCreateView.as_view()),
    # re_path('restaurants/(?P<slug>[\w+-])/', RestaurantListView.as_view(), name="search_restaurant_page"),
    re_path('restaurants/(?P<slug>[\w-]+)/',
            RestaurantDetailView.as_view(),
            name="search_restaurant_detail_page"),
    path('cart/', include('cart.urls', namespace='cart')),
    path('orders/', include('orders.urls', namespace='orders')),
    path('shop/', include('shop.urls', namespace='shop')),
]

if settings.DEBUG:
    # urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)