diff options
Diffstat (limited to 'app/projects')
-rw-r--r-- | app/projects/admin.py | 15 | ||||
-rw-r--r-- | app/projects/models/__init__.py | 3 | ||||
-rw-r--r-- | app/projects/urls.py | 1 | ||||
-rw-r--r-- | app/projects/views.py | 7 |
4 files changed, 21 insertions, 5 deletions
diff --git a/app/projects/admin.py b/app/projects/admin.py index 94c4780..13357b0 100644 --- a/app/projects/admin.py +++ b/app/projects/admin.py @@ -7,6 +7,7 @@ from django.conf import settings from projects.models.base import Project from projects.models.fiveby import FiveBy from projects.models.natparks import NationalParks +from projects.models.gifs import AnimatedGif GMAP = GoogleMap(key=settings.GOOGLE_MAPS_API_KEY) @@ -174,9 +175,17 @@ class CodeAdmin(admin.ModelAdmin): fieldsets = ( (None, {'fields': ('name','date_created','slug','status','body_html')}), ) - -admin.site.register(Code, CodeAdmin) +class AnimatedGifAdmin(admin.ModelAdmin): + list_display = ('title', 'date_created') + search_fields = ['title',] + fieldsets = ( + (None, {'fields': ('title','gif','date_created','slug','music_ogg','music_mp3')}), + ) + + +admin.site.register(AnimatedGif, AnimatedGifAdmin) +admin.site.register(Code, CodeAdmin) admin.site.register(Project, ProjectAdmin) admin.site.register(FiveBy, FiveByAdmin) -admin.site.register(NationalParks, NationalParksAdmin)
\ No newline at end of file +admin.site.register(NationalParks, NationalParksAdmin) diff --git a/app/projects/models/__init__.py b/app/projects/models/__init__.py index 7fe6077..6f61282 100644 --- a/app/projects/models/__init__.py +++ b/app/projects/models/__init__.py @@ -1,4 +1,5 @@ from base import Project from fiveby import FiveBy from natparks import NationalParks -from code import Code
\ No newline at end of file +from code import Code +from gifs import AnimatedGif diff --git a/app/projects/urls.py b/app/projects/urls.py index 14722a8..83f07c7 100644 --- a/app/projects/urls.py +++ b/app/projects/urls.py @@ -11,6 +11,7 @@ projects = { urlpatterns = patterns('', (r'data/(?P<id>\d+)/$', 'projects.views.data_json'), + (r'gifs/(?P<slug>[-\w]+)/$', 'projects.views.gif_detail'), (r'(?P<slug>[-\w]+)/$', 'projects.views.detail'), (r'^$',list_detail.object_list, dict(projects, template_name='archives/projects.html')), ) diff --git a/app/projects/views.py b/app/projects/views.py index 64857a7..e25802b 100644 --- a/app/projects/views.py +++ b/app/projects/views.py @@ -9,6 +9,7 @@ from projects.shortcuts import render_to_geojson from projects.models.base import Project from projects.models.fiveby import FiveBy from projects.models.natparks import NationalParks +from projects.models.gifs import AnimatedGif projects = {'5x5':'FiveBy','6x6':'SixBy','national-parks':'NationalParks','code':'Code'} @@ -25,6 +26,10 @@ def detail(request,slug): template = 'details/%s.html' %(slug) return object_list(request, queryset=qs, template_name=template,) +def gif_detail(request,slug): + obj = get_object_or_404(AnimatedGif, slug__exact=slug) + return render_to_response('details/gifs.html', {'object': obj}, context_instance=RequestContext(request)) + def data_json(request, id): qs = NationalParks.objects.filter(pk=id) @@ -35,4 +40,4 @@ def data_json(request, id): mimetype = 'application/json', pretty_print=True ) -
\ No newline at end of file + |