Пример #1
0
from website.views import IndexTemplateView, FuncionarioListView, \
    FuncionarioUpdateView, FuncionarioCreateView, FuncionarioDeleteView
from django.urls import path

app_name = 'website'

urlpatterns = [
    # GET /
    path('', IndexTemplateView.as_view(), name="index"),

    # GET /funcionario/cadastrar
    path('funcionario/cadastrar',
         FuncionarioCreateView.as_view(),
         name="cadastra_funcionario"),

    # GET /funcionarios
    path('funcionarios/',
         FuncionarioListView.as_view(),
         name="lista_funcionarios"),

    # GET/POST /funcionario/{pk}
    path('funcionario/<pk>',
         FuncionarioUpdateView.as_view(),
         name="atualiza_funcionario"),

    # GET/POST /funcionarios/excluir/{pk}
    path('funcionario/excluir/<pk>',
         FuncionarioDeleteView.as_view(),
         name="deleta_funcionario"),
]
Пример #2
0
from django.urls import path
from website.views import IndexTemplateView

app_name = 'website'

# urlpatterns a lista de roteamentos de URLs para funções/Views
urlpatterns = [
    # GET /
    path('', IndexTemplateView.as_view()),
]

Пример #3
0
# Importamos a função index() definida no arquivo views.py
from django.urls import path
from website.views import IndexTemplateView, FuncionarioListView, FuncionarioUpdateView, FuncionarioCreateView, FuncionarioDeleteView

app_name = 'website'

# urlpatterns contém a lista de roteamentos de URLs
urlpatterns = [
    # Get /
    path('', IndexTemplateView.as_view(), name='index'),

    # Get /funcionario/cadastrar
    path('funcionario/cadastrar',
         FuncionarioCreateView.as_view(),
         name="cadastra_funcionario"),

    # Get /funcionario
    path('funcionarios/',
         FuncionarioListView.as_view(),
         name="lista_funcionarios"),

    # Get/Post /funcionario/{pk}
    path('funcionario/<pk>',
         FuncionarioUpdateView.as_view(),
         name="atualiza_funcionario"),

    # Get/Post /funcionarios/excluir/{pk}
    path('funcionario/excluir/<pk>',
         FuncionarioDeleteView.as_view(),
         name="deleta_funcionario"),
]
Пример #4
0
admin.autodiscover()

from django.http import HttpResponse

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'ciensonrisas.views.home', name='home'),
    # url(r'^ciensonrisas/', include('ciensonrisas.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),

    url(r'^$', IndexTemplateView.as_view(template_name='index.html'),
        name='home'),
    url(r'^miralas$', ListView.as_view(model=Place), name='places'),
    url(r'^miralas/(?P<slug>[a-z0-9-_]+)$', PlaceDetailView.as_view(),
        name='place_detail'),
    url(r'^miralas/(?P<place_slug>[a-z0-9-_]+)/(?P<number>\d+)$', smile_detail,
        name='smile_detail'),
    url(r'^contact$', MessageCreate.as_view(),
        name='contact_form'),
    url(r'^contact/thanks$', TemplateView.as_view(template_name='thanks.html'),
        name='contact_thanks'),


    (r'^robots\.txt$', lambda r: HttpResponse("User-agent: *\nDisallow: /", mimetype="text/plain"))
)