annotate gpp/gcalendar/admin.py @ 6:b6263ac72052

Use DRY principle to manage third party javascript libraries. Created script_tags template tags to generate the correct link and script tags for 3rd party libraries. The settings.py file is the only place where the full path name is specified.
author Brian Neal <bgneal@gmail.com>
date Sat, 11 Apr 2009 22:50:56 +0000
parents dbd703f7d63a
children e04d91babfcf
rev   line source
gremmie@1 1 """
gremmie@1 2 This file contains the automatic admin site definitions for the gcalendar application.
gremmie@1 3 """
gremmie@1 4 from django.contrib import admin
gremmie@1 5 from django.http import HttpResponse
gremmie@1 6 from django.conf.urls.defaults import *
gremmie@1 7
gremmie@1 8 from gcalendar.models import Event
gremmie@1 9 from gcalendar.admin_views import google_sync
gremmie@1 10
gremmie@1 11
gremmie@1 12 class EventAdmin(admin.ModelAdmin):
gremmie@1 13 list_display = ('what', 'user', 'start_date', 'where', 'date_submitted',
gremmie@1 14 'status', 'needs_approval')
gremmie@1 15 list_filter = ('start_date', 'status')
gremmie@1 16 search_fields = ('what', 'where', 'description')
gremmie@1 17 raw_id_fields = ('user', )
gremmie@1 18 exclude = ('html', 'google_id')
gremmie@1 19 save_on_top = True
gremmie@1 20
gremmie@1 21 def get_urls(self):
gremmie@1 22 urls = super(EventAdmin, self).get_urls()
gremmie@1 23 my_urls = patterns('',
gremmie@1 24 url(r'^google_sync/$',
gremmie@1 25 self.admin_site.admin_view(google_sync),
gremmie@1 26 name="gcalendar-google_sync")
gremmie@1 27 )
gremmie@1 28 return my_urls + urls
gremmie@1 29
gremmie@1 30
gremmie@1 31 admin.site.register(Event, EventAdmin)
gremmie@1 32
gremmie@1 33 # vim: ts=4 sw=4