1 from django.conf import settings
2 from photo.models import Album, Photo
5 def content_breadcrumb(request):
7 if path[0:6] == "/photo":
8 breadcrumb = [{'url': u'/', 'title': u'Home'}, {'url': u'/photo/', 'title': u'Photos'}]
11 album_slug = path.split('/', 1)[0]
12 album = Album.objects.get(slug__exact=album_slug)
13 breadcrumb.append({'url': u'/photo/%s/' %(album_slug), 'title': album.name})
15 rest = path.split('/', 1)[1]
17 photo_id = rest.split('/')[0]
18 photo_id = int(photo_id)
19 photo = Photo.objects.get(id=photo_id)
20 breadcrumb.append({'url': request.path, 'title': photo.image.name.split('/')[-1]})
27 'content_breadcrumb': breadcrumb,