Mercurial > agora-palash
annotate apps/bundle/views.py @ 63:d5ebcf4a249f
Added some urls for the bundle links, and a template
author | Rettaw |
---|---|
date | Thu, 06 Oct 2011 23:40:01 +0200 |
parents | ba2dad0d7f2a |
children | c7be7def8b57 |
rev | line source |
---|---|
37
ba2dad0d7f2a
Do license framework (need to create an SQL fixture for them)
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
35
diff
changeset
|
1 from django.shortcuts import get_object_or_404 |
4
069cabdaf8b2
Define stub template and admin site
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
2
diff
changeset
|
2 from agora.apps.bundle.models import * |
37
ba2dad0d7f2a
Do license framework (need to create an SQL fixture for them)
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
35
diff
changeset
|
3 from django.views.generic.simple import direct_to_template |
63 | 4 from django.http import HttpResponse |
4
069cabdaf8b2
Define stub template and admin site
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
2
diff
changeset
|
5 |
069cabdaf8b2
Define stub template and admin site
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
2
diff
changeset
|
6 def detail(request, user, bundle): |
6
c83460992637
Elaborate on stub bundle template
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
4
diff
changeset
|
7 b = get_object_or_404(Bundle, uploader__username=user, name=bundle) |
c83460992637
Elaborate on stub bundle template
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
4
diff
changeset
|
8 f = BundleFile.objects.filter(bundle=b) |
c83460992637
Elaborate on stub bundle template
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
4
diff
changeset
|
9 |
63 | 10 return direct_to_template(request, 'bundle/bundle.djhtml', |
35
290dd9208cc4
Implement editing user profiles and fix bugs related to the login/logout buttons. Implement 403 exception
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
6
diff
changeset
|
11 { |
290dd9208cc4
Implement editing user profiles and fix bugs related to the login/logout buttons. Implement 403 exception
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
6
diff
changeset
|
12 'bundle':b, |
290dd9208cc4
Implement editing user profiles and fix bugs related to the login/logout buttons. Implement 403 exception
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
6
diff
changeset
|
13 'files': f, |
290dd9208cc4
Implement editing user profiles and fix bugs related to the login/logout buttons. Implement 403 exception
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
6
diff
changeset
|
14 }, |
290dd9208cc4
Implement editing user profiles and fix bugs related to the login/logout buttons. Implement 403 exception
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
6
diff
changeset
|
15 ) |
63 | 16 |
17 def index(request): | |
18 try: | |
19 b = Bundle.objects.all().order_by('pub_date')[:5] | |
20 except Bundle.DoesNotExist: | |
21 raise Http404 | |
22 | |
23 return direct_to_template(request, 'bundle/index.djhtml', | |
24 { | |
25 'bundles':b, | |
26 }, | |
27 ) |