Exemple #1
0
from django.conf.urls import patterns, include, url
from recipes.views import FoodListView, FoodDetailView, FoodCreateView, FoodDeleteView, RecipeListView, RecipeCreateView, RecipeDetailView, RecipeUpdateView, RecipeDeleteView, IngredientCreateView, IngredientDeleteView

urlpatterns = patterns(
    '',
    url(r'^food/$', FoodListView.as_view(), name='food-list'),
    url(r'^food/(?P<pk>\d+)$', FoodDetailView.as_view(), name='food-detail'),
    url(r'^food/create$', FoodCreateView.as_view(), name='food-create'),
    url(r'^food/(?P<pk>\d+)/remove_food$',
        FoodDeleteView.as_view(),
        name='food-delete'),
    url(r'^$', RecipeListView.as_view(), name='recipe-list'),
    url(r'^new/$', RecipeCreateView.as_view(), name='recipe-create'),
    url(r'^(?P<slug>[-\w]+)$',
        RecipeDetailView.as_view(),
        name='recipe-detail'),
    url(r'^(?P<slug>[-\w]+)/update$',
        RecipeUpdateView.as_view(),
        name='recipe-update'),
    url(r'^(?P<slug>[-\w]+)/remove_recipe$',
        RecipeDeleteView.as_view(),
        name='recipe-delete'),
    url(r'^(?P<slug>[-\w]+)/add_ingredient/$',
        IngredientCreateView.as_view(),
        name='ingredient-create'),
    url(r'^(?P<slug>[-\w]+)/remove_ingredient/(?P<pk>\d+)/$',
        IngredientDeleteView.as_view(),
        name='ingredient-delete'),
)
Exemple #2
0
from django.conf.urls import patterns, include, url
from recipes.views import FoodListView, FoodDetailView, FoodCreateView, FoodDeleteView, RecipeListView, RecipeCreateView, RecipeDetailView, RecipeUpdateView, RecipeDeleteView, IngredientCreateView, IngredientDeleteView 


urlpatterns = patterns('',
	url(r'^food/$', FoodListView.as_view(), name='food-list'),
	url(r'^food/(?P<pk>\d+)$', FoodDetailView.as_view(), name='food-detail'),
	url(r'^food/create$', FoodCreateView.as_view(), name = 'food-create'),
	url(r'^food/(?P<pk>\d+)/remove_food$', FoodDeleteView.as_view(), name ='food-delete'),
	url(r'^$', RecipeListView.as_view(), name='recipe-list'),
	url(r'^new/$', RecipeCreateView.as_view(), name='recipe-create'),
	url(r'^(?P<slug>[-\w]+)$', RecipeDetailView.as_view(), name='recipe-detail'),
	url(r'^(?P<slug>[-\w]+)/update$', RecipeUpdateView.as_view(), name='recipe-update'),
	url(r'^(?P<slug>[-\w]+)/remove_recipe$', RecipeDeleteView.as_view(), name='recipe-delete'),
	url(r'^(?P<slug>[-\w]+)/add_ingredient/$', IngredientCreateView.as_view(), name='ingredient-create'),
	url(r'^(?P<slug>[-\w]+)/remove_ingredient/(?P<pk>\d+)/$', IngredientDeleteView.as_view(), name='ingredient-delete'),
	





        )
Exemple #3
0
    FavoritesListView,
    FollowListView,
    PurchasesListView,
    RecipeCreateView,
    RecipeDeleteView,
    RecipeEditView,
    RecipeListView,
    RecipeView,
)

urlpatterns = [
    path('', RecipeListView.as_view(), name='index'),
    path('author/<str:username>/', AuthorListView.as_view(), name='author'),
    path('recipe/slug/<str:slug>/',
         RecipeView.as_view(),
         name='recipe_by_slug'),
    path('recipe/id/<int:pk>/', RecipeView.as_view(), name='recipe_by_id'),
    path('recipe/id/<int:pk>/edit/',
         RecipeEditView.as_view(),
         name='recipe_edit'),
    path('recipe/id/<int:pk>/delete/',
         RecipeDeleteView.as_view(),
         name='recipe_delete'),
    path('recipe/new/', RecipeCreateView.as_view(), name='new_recipe'),
    path('subscriptions/', FollowListView.as_view(), name='subscriptions'),
    path('favorites/', FavoritesListView.as_view(), name='favorites'),
    path('purchases/', PurchasesListView.as_view(), name='purchases'),
    path('about/author', about_author, name='about author'),
    path('about/tech', about_tech, name='about tech'),
]
Exemple #4
0
from django.urls import path

from django_filters.views import FilterView

from recipes.views import (RecipeCreateView, RecipeDetailView, RecipeListView,
                           RecipeUpdateView, RecipeDeleteView)
from recipes.filters import RecipeFilter

recipe_patterns = [
    path('search/', FilterView.as_view(filterset_class=RecipeFilter), name='filter'),
    path('list/', RecipeListView.as_view(), name='list'),
    path('create/', RecipeCreateView.as_view(), name='create'),
    path('update/<int:pk>/', RecipeUpdateView.as_view(), name='update'),
    path('delete/<int:pk>/', RecipeDeleteView.as_view(), name='delete'),
    path('detail/<int:pk>/', RecipeDetailView.as_view(), name='detail'),

]
Exemple #5
0
"""myKitchen 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, include

from recipes.views import RecipeListView, RecipeCreateView, RecipeDetailView

urlpatterns = [
    url(regex=r'^$', view=RecipeListView.as_view(), name='recipe_list_api'),
    url(regex=r'^create/$',
        view=RecipeCreateView.as_view(),
        name='recipe_create_api'),
    url(regex=r'^(?P<uuid>[-\w]+)/$',
        view=RecipeDetailView.as_view(),
        name='recipe_detail_api')
]