comparison gpp/gcalendar/forms.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 f408971657b9
comparison
equal deleted inserted replaced
5:63696b279e35 6:b6263ac72052
2 Forms for the gcalendar application. 2 Forms for the gcalendar application.
3 """ 3 """
4 import datetime 4 import datetime
5 import pytz 5 import pytz
6 from django import forms 6 from django import forms
7 from django.conf import settings
7 8
8 from gcalendar.models import Event 9 from gcalendar.models import Event
9 10
10 11
11 TIME_CHOICES = ( 12 TIME_CHOICES = (
78 fields = ('what', 'start_date', 'start_time', 'end_date', 'end_time', 79 fields = ('what', 'start_date', 'start_time', 'end_date', 'end_time',
79 'all_day', 'time_zone', 'where', 'description') 80 'all_day', 'time_zone', 'where', 'description')
80 81
81 class Media: 82 class Media:
82 css = { 83 css = {
83 'all': ('js/markitup/skins/markitup/style.css', 84 'all': settings.GPP_THIRD_PARTY_CSS['markitup'] + \
84 'js/markitup/sets/markdown/style.css', 85 settings.GPP_THIRD_PARTY_CSS['jquery-ui'] + \
85 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/redmond/jquery-ui.css', 86 ('css/gcalendar.css', )
86 'css/gcalendar.css',
87 )
88 } 87 }
89 js = ( 88 js = settings.GPP_THIRD_PARTY_JS['jquery'] + \
90 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', 89 settings.GPP_THIRD_PARTY_JS['markitup'] + \
91 'js/markitup/jquery.markitup.pack.js', 90 settings.GPP_THIRD_PARTY_JS['jquery-ui'] + \
92 'js/markitup/sets/markdown/set.js', 91 ('js/gcalendar.js', )
93 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/jquery-ui.js',
94 'js/gcalendar.js',
95 )
96 92
97 def __init__(self, *args, **kwargs): 93 def __init__(self, *args, **kwargs):
98 initial = kwargs.get('initial', {}) 94 initial = kwargs.get('initial', {})
99 instance = kwargs.get('instance', None) 95 instance = kwargs.get('instance', None)
100 96