Guest User

Untitled

a guest
Jan 19th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. #html
  2. <li><a href="/fiches-d-elevages/{{ fiche.categorie|slugify }}/{{ fiche.sous_categorie|slugify }}/{{ fiche.nom_latin|slugify }}-{{ fiche.nom_commun|slugify }}/" title="Afficher la fiche d'élevage de {{ fiche.nom_latin }}( {{ fiche.nom_commun }} - {{ fiche.categorie }}, {{ fiche.sous_categorie }})"> {{ fiche.nom_latin }} - {{ fiche.nom_commun }}</a></li>
  3.  
  4. #urls.py
  5. (r'^(?P<categorie>\w+)/(?P<souscategorie>\w+)/(?P<nomlatin>\w+)-(?P<nomcommun>\w+)', 'fiches.views.details'),
  6.     (r'^(?P<categorie>\w+)/(?P<nomlatin>\w+)-(?P<nomcommun>\w+)', 'fiches.views.details'),
  7.  
  8. #views
  9. def details(request, categorie, souscategorie, nomlatin, nomcommun):
  10.     if souscategorie:
  11.         fiche = get_object_or_404(Fiches, nom_latin=nomlatin, nom_commun=nomcommun, categorie__nom=categorie, sous_categorie__nom=souscategorie)
  12.     else:
  13.         fiche = get_object_or_404(Fiches, nom_latin=nomlatin, nom_commun=nomcommun, categorie=categorie)
  14.    
  15.     return render_to_response('fiches/details.html', {'fiche':fiche})
  16.  
  17.  
  18. #results:
  19. fiches-d-elevages/reptiles/serpents/pantherophis-guttatus-guttatus-serpent-des-bles/
  20. app/category/subcategory/nom-latin-nom-commun/
  21.  
  22. he existe with id 1
  23. (page not found - 404: No Fiches matches the given query.)
Add Comment
Please, Sign In to add comment