Skip to content

Instantly share code, notes, and snippets.

@gcavalcante8808
Created April 24, 2012 13:39
Show Gist options
  • Save gcavalcante8808/2479745 to your computer and use it in GitHub Desktop.
Save gcavalcante8808/2479745 to your computer and use it in GitHub Desktop.
Exemplo Views.py --> Urls Amigáveis
from django.conf.urls.defaults import *
urlpatterns = patterns ('',
(r'^divulgacao/(?P<slug_categoria>[\w_-]+)/(?P<slug_divulgacao>[\w_-]+)/$', 'CAMINHOPARAAVIEW'),
)
def news_page(request, slug_categoria, slug_divulgacao):
news = get_object_or_404(Noticia, categoria__slugcategoria=slug_categoria, slugdivulgacao=slug_divulgacao)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment