tutorial-django-remake-crud / urls.py

from django.conf.urls.defaults import *
from django.views.generic import create_update
from django.views.generic import list_detail
from alunos.models import Aluno

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

params_novo_aluno = {
            'model' : Aluno,
            'post_save_redirect' : '/alunos/',

params_delete_aluno = {
            'model' : Aluno,
            'post_delete_redirect' : '/alunos/',

urlpatterns = patterns('',
    # Example:
    # (r'^abcdef_academico/', include('abcdef_academico.foo.urls')),

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

    # Uncomment the next line to enable the admin:
    # (r'^admin/', include(admin.site.urls)),
    (r'alunos/novo/$', create_update.create_object, params_novo_aluno, 'novo_aluno'),
    (r'alunos/$', list_detail.object_list, { 'queryset' : Aluno.objects.all() }, 'lista_alunos'),
    (r'alunos/(?P<object_id>\d+)/$', list_detail.object_detail, { 'queryset' : Aluno.objects.all() }, 'ver_aluno'),
    (r'alunos/(?P<object_id>\d+)/editar/$', create_update.update_object, params_novo_aluno, 'editar_aluno'),
    (r'alunos/(?P<object_id>\d+)/apagar/$', create_update.delete_object, params_delete_aluno, 'apagar_aluno'),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.