Merge lp:~mhall119/loco-team-portal/jquery-choosers into lp:loco-team-portal

Proposed by Michael Hall
Status: Superseded
Proposed branch: lp:~mhall119/loco-team-portal/jquery-choosers
Merge into: lp:loco-team-portal
Diff against target: 283 lines (+66/-41)
10 files modified
INSTALL (+3/-1)
loco_directory/events/forms.py (+32/-13)
loco_directory/events/models.py (+3/-3)
loco_directory/locale/loco-directory.pot (+10/-9)
loco_directory/media/js/events-ui.js (+12/-0)
loco_directory/templates/events/global_event_new.html (+2/-4)
loco_directory/templates/events/global_event_update.html (+0/-3)
loco_directory/templates/events/team_event_new.html (+1/-3)
loco_directory/templates/events/team_event_update.html (+1/-4)
loco_directory/templates/teams/team_detail.html (+2/-1)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/jquery-choosers
Reviewer Review Type Date Requested Status
Daniel Holbach Pending
Review via email: mp+16849@code.launchpad.net

This proposal supersedes a proposal from 2010-01-04.

This proposal has been superseded by a proposal from 2010-01-05.

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote : Posted in a previous version of this proposal

Added JQuery components. You will need to follow the additional instructions in the INSTALL to get the proper packages and make symlinks to them

Revision history for this message
Daniel Holbach (dholbach) wrote : Posted in a previous version of this proposal

 - libjs-jquery-ui depends on libjs-jquery, so no need to list both.
 - the javascript you use in several templates, can we put that into media/js or something?
 - does this branch contain the changes of lp:~mhall119/loco-directory/team_events_details ?

review: Needs Fixing
Revision history for this message
Michael Hall (mhall119) wrote : Posted in a previous version of this proposal

This contains a modified translation string using blocktrans for the team_detail.html link title text, as well as the changes requested in the last merge proposal

Revision history for this message
Daniel Holbach (dholbach) wrote : Posted in a previous version of this proposal

Why do we need the Media class definition twice in loco_directory/events/forms.py? It seems like a simple mapping we could just define once somewhere.

Apart from that: good work! :)

review: Needs Fixing
Revision history for this message
Michael Hall (mhall119) wrote : Posted in a previous version of this proposal

I generally don't consider something that is only used in 2 places a candidate for reusability, but that is the preference for this project I'll change it.

29. By Michael Hall

Removed dependency on django.contrib.admin for date/time widgets

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'INSTALL'
2--- INSTALL 2009-12-21 11:03:49 +0000
3+++ INSTALL 2010-01-05 14:28:15 +0000
4@@ -1,4 +1,4 @@
5- - sudo apt-get install postgresql-8.3 python-django python-psycopg2 python-launchpadlib
6+ - sudo apt-get install postgresql-8.3 python-django python-psycopg2 python-launchpadlib libjs-jquery-ui
7 - install python-django-openid-auth from karmic or from:
8 http://archive.ubuntu.com/ubuntu/pool/universe/p/python-django-openid-auth/
9
10@@ -11,6 +11,8 @@
11 - sudo -u postgres createdb -O postgres loco_directory
12 - cd loco_directory
13 - cp settings.py.sample settings.py
14+ - ln -s /usr/share/javascript/jquery media/jquery
15+ - ln -s /usr/share/javascript/jquery-ui media/jquery-ui
16 # edit settings.py and set DATABASE_USER, DATABASE_PASSWORD, SECRET_KEY
17 - ./manage.py syncdb
18 - ./manage.py compilemessages
19
20=== modified file 'loco_directory/events/forms.py'
21--- loco_directory/events/forms.py 2009-12-22 21:31:02 +0000
22+++ loco_directory/events/forms.py 2010-01-05 14:28:15 +0000
23@@ -3,35 +3,54 @@
24 from django import forms
25 from django.contrib import admin
26
27+from models import BaseEvent
28 from models import GlobalEvent
29 from models import TeamEvent
30
31
32-class TeamEventForm(forms.ModelForm):
33+class BaseEventForm(forms.ModelForm):
34+ """
35+ a form to create/update a BaseEvent
36+ """
37+ class Meta:
38+ model = BaseEvent
39+ exclude = ('date_created')
40+
41+ class Media:
42+ css = {'all': (
43+ '/media/jquery-ui/css/css/smoothness/jquery-ui-1.7.1.custom.css',
44+ '/media/jquery-ui-timepicker/css/ui-lightness/ui.timepickr.css',
45+ )}
46+ js = (
47+ '/media/jquery/jquery.min.js',
48+ '/media/jquery-ui/jquery-ui-1.7.1.custom.min.js',
49+ '/media/jquery-ui-timepicker/js/jquery.timepickr.min.js',
50+ '/media/jquery-ui-timepicker/js/ui.timepickr.min.js',
51+ '/media/js/events-ui.js',
52+ )
53+
54+ def __init__(self, *args, **kargs):
55+ super(BaseEventForm, self).__init__(*args, **kargs)
56+ self.fields['date_begin'].widget = admin.widgets.AdminSplitDateTime()
57+ self.fields['date_end'].widget = admin.widgets.AdminSplitDateTime()
58+
59+class TeamEventForm(BaseEventForm):
60 """
61 a form to create/update a TeamEvent
62 """
63- class Meta:
64+ class Meta(BaseEventForm.Meta):
65 model = TeamEvent
66 exclude = ('teams', 'date_created')
67
68- def __init__(self, *args, **kargs):
69- super(TeamEventForm, self).__init__(*args, **kargs)
70- self.fields['date_begin'].widget = admin.widgets.AdminSplitDateTime()
71- self.fields['date_end'].widget = admin.widgets.AdminSplitDateTime()
72
73-class GlobalEventForm(forms.ModelForm):
74+class GlobalEventForm(BaseEventForm):
75 """
76 a form to create/update a GlobalEvent
77 """
78- class Meta:
79+ class Meta(BaseEventForm.Meta):
80 model = GlobalEvent
81- exclude = ('date_created')
82+# exclude = ('date_created')
83
84- def __init__(self, *args, **kargs):
85- super(GlobalEventForm, self).__init__(*args, **kargs)
86- self.fields['date_begin'].widget = admin.widgets.AdminSplitDateTime()
87- self.fields['date_end'].widget = admin.widgets.AdminSplitDateTime()
88
89
90
91
92=== modified file 'loco_directory/events/models.py'
93--- loco_directory/events/models.py 2009-12-23 12:20:45 +0000
94+++ loco_directory/events/models.py 2010-01-05 14:28:15 +0000
95@@ -63,15 +63,15 @@
96 """ manager for a team event """
97 def next_5_events(self):
98 """ a list with the next 5 events """
99- return self.filter(date_end__gt=datetime.datetime.now()).order_by('-date_begin')[:5]
100+ return self.filter(date_end__gt=datetime.datetime.now()).order_by('date_begin')[:5]
101
102 def next_events(self):
103 """ a list with all upcoming team events """
104- return self.filter(date_end__gt=datetime.datetime.now()).order_by('-date_begin')
105+ return self.filter(date_end__gt=datetime.datetime.now()).order_by('date_begin')
106
107 def history_events(self):
108 """ all team events in history """
109- return self.filter(date_end__lt=datetime.datetime.now()).order_by('-date_begin')
110+ return self.filter(date_end__lt=datetime.datetime.now()).order_by('-date_end')
111
112 def attending(self):
113 return Attendee.objects.filter(event__id__exact=self.id)
114
115=== modified file 'loco_directory/locale/loco-directory.pot'
116--- loco_directory/locale/loco-directory.pot 2010-01-05 09:09:01 +0000
117+++ loco_directory/locale/loco-directory.pot 2010-01-05 14:28:15 +0000
118@@ -8,7 +8,7 @@
119 msgstr ""
120 "Project-Id-Version: PACKAGE VERSION\n"
121 "Report-Msgid-Bugs-To: \n"
122-"POT-Creation-Date: 2010-01-05 09:06+0000\n"
123+"POT-Creation-Date: 2010-01-05 14:09+0000\n"
124 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
125 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
126 "Language-Team: LANGUAGE <LL@li.org>\n"
127@@ -543,12 +543,12 @@
128 msgid "New Global Event"
129 msgstr ""
130
131-#: templates/events/global_event_new.html:13
132+#: templates/events/global_event_new.html:11
133 msgid "Add new Global Event"
134 msgstr ""
135
136 #: templates/events/global_event_update.html:4
137-#: templates/events/global_event_update.html:14
138+#: templates/events/global_event_update.html:11
139 msgid "Update Global Event"
140 msgstr ""
141
142@@ -564,12 +564,12 @@
143 msgid "New Team Event"
144 msgstr ""
145
146-#: templates/events/team_event_new.html:13
147+#: templates/events/team_event_new.html:11
148 msgid "Add new Team Event"
149 msgstr ""
150
151 #: templates/events/team_event_update.html:4
152-#: templates/events/team_event_update.html:15
153+#: templates/events/team_event_update.html:12
154 msgid "Update Team Event"
155 msgstr ""
156
157@@ -589,7 +589,7 @@
158 msgid "Location:"
159 msgstr ""
160
161-#: templates/teams/team_detail.html:38 templates/teams/team_detail.html:99
162+#: templates/teams/team_detail.html:38 templates/teams/team_detail.html:100
163 msgid "None Specified"
164 msgstr ""
165
166@@ -637,11 +637,12 @@
167 msgid "Upcoming Events:"
168 msgstr ""
169
170-#: templates/teams/team_detail.html:98
171-msgid "More Information about the Event"
172+#: templates/teams/team_detail.html:99
173+#, python-format
174+msgid "%(start_date)s in %(city)s"
175 msgstr ""
176
177-#: templates/teams/team_detail.html:98
178+#: templates/teams/team_detail.html:99
179 msgid "Show detailed Event List"
180 msgstr ""
181
182
183=== added directory 'loco_directory/media/js'
184=== added file 'loco_directory/media/js/events-ui.js'
185--- loco_directory/media/js/events-ui.js 1970-01-01 00:00:00 +0000
186+++ loco_directory/media/js/events-ui.js 2010-01-05 14:28:15 +0000
187@@ -0,0 +1,12 @@
188+$(document).ready(function(){
189+
190+ $.datepicker.setDefaults({
191+ showOn: 'focus',
192+ dateFormat: 'yy-mm-dd'
193+ });
194+
195+ $("input.vDateField").datepicker();
196+
197+ $('input.vTimeField').timepickr({ trigger: 'focus', convention: 24 });
198+
199+});
200
201=== modified file 'loco_directory/templates/events/global_event_new.html'
202--- loco_directory/templates/events/global_event_new.html 2009-12-22 23:09:58 +0000
203+++ loco_directory/templates/events/global_event_new.html 2010-01-05 14:28:15 +0000
204@@ -2,10 +2,8 @@
205 {% load i18n %}
206
207 {% block title %}{% trans "New Global Event" %}{% endblock %}
208+
209 {% block extrahead %}{{ block.super }}
210-<link rel="stylesheet" type="text/css" href="/media/admin/css/widgets.css" />
211-<script type="text/javascript" src="/jsi18n/"></script>
212-<script type="text/javascript" src="/media/admin/js/core.js"></script>
213 {{form.media}}
214 {% endblock %}
215
216@@ -19,4 +17,4 @@
217 </form>
218
219
220-{% endblock %}
221+{% endblock %}
222\ No newline at end of file
223
224=== modified file 'loco_directory/templates/events/global_event_update.html'
225--- loco_directory/templates/events/global_event_update.html 2009-12-22 23:09:58 +0000
226+++ loco_directory/templates/events/global_event_update.html 2010-01-05 14:28:15 +0000
227@@ -4,9 +4,6 @@
228 {% block title %}{% trans "Update Global Event" %}{% endblock %}
229
230 {% block extrahead %}{{ block.super }}
231-<link rel="stylesheet" type="text/css" href="/media/admin/css/widgets.css" />
232-<script type="text/javascript" src="/jsi18n/"></script>
233-<script type="text/javascript" src="/media/admin/js/core.js"></script>
234 {{form.media}}
235 {% endblock %}
236
237
238=== modified file 'loco_directory/templates/events/team_event_new.html'
239--- loco_directory/templates/events/team_event_new.html 2009-12-22 23:09:58 +0000
240+++ loco_directory/templates/events/team_event_new.html 2010-01-05 14:28:15 +0000
241@@ -2,10 +2,8 @@
242 {% load i18n %}
243
244 {% block title %}{% trans "New Team Event" %}{% endblock %}
245+
246 {% block extrahead %}{{ block.super }}
247-<link rel="stylesheet" type="text/css" href="/media/admin/css/widgets.css" />
248-<script type="text/javascript" src="/jsi18n/"></script>
249-<script type="text/javascript" src="/media/admin/js/core.js"></script>
250 {{form.media}}
251 {% endblock %}
252
253
254=== modified file 'loco_directory/templates/events/team_event_update.html'
255--- loco_directory/templates/events/team_event_update.html 2009-12-22 23:09:58 +0000
256+++ loco_directory/templates/events/team_event_update.html 2010-01-05 14:28:15 +0000
257@@ -1,12 +1,9 @@
258 {% extends "base.html" %}
259-{% load i18n %}
260+{% load i18n admin_modify adminmedia %}
261
262 {% block title %}{% trans "Update Team Event" %}{% endblock %}
263
264 {% block extrahead %}{{ block.super }}
265-<link rel="stylesheet" type="text/css" href="/media/admin/css/widgets.css" />
266-<script type="text/javascript" src="/jsi18n/"></script>
267-<script type="text/javascript" src="/media/admin/js/core.js"></script>
268 {{form.media}}
269 {% endblock %}
270
271
272=== modified file 'loco_directory/templates/teams/team_detail.html'
273--- loco_directory/templates/teams/team_detail.html 2009-12-26 10:00:19 +0000
274+++ loco_directory/templates/teams/team_detail.html 2010-01-05 14:28:15 +0000
275@@ -95,7 +95,8 @@
276 <th scope="row"><label>{% trans "Upcoming Events:" %}</label></th>
277 <td>{% if team.teamevent_set.next_5_events %}
278 {% for team_event in team.teamevent_set.next_5_events %}
279- <a title="{% trans "More Information about the Event" %}" href="{% url team-event-detail team_event.id %}">{{ team_event.name }}</a>{% if not forloop.last %},{% endif %} (<a href="{% url team-event-list team.lp_name %}">{% trans "Show detailed Event List" %}</a>)
280+ {% comment %}TRANSLATORS: If event has a venue, show: date "in" city{% endcomment %}
281+ <a title="{% if team_event.venue %}{% blocktrans with team_event.date_begin|date:"M d" as start_date and team_event.venue.city as city %}{{start_date}} in {{city}}{% endblocktrans %}{% else %}{{team_event.date_begin|date:"M d"}}{% endif %}" href="{% url team-event-detail team_event.id %}">{{ team_event.name }}</a>{% if not forloop.last %},{% endif %} (<a href="{% url team-event-list team.lp_name %}">{% trans "Show detailed Event List" %}</a>)
282 {% endfor %}{% else %}{% trans "None Specified" %}{% endif %}</td>
283 </tr>
284

Subscribers

People subscribed via source and target branches