Merge lp:~cjohnston/summit/track-display-name into lp:summit

Proposed by Chris Johnston
Status: Merged
Approved by: Michael Hall
Approved revision: 506
Merged at revision: 505
Proposed branch: lp:~cjohnston/summit/track-display-name
Merge into: lp:summit
Diff against target: 287 lines (+85/-20)
12 files modified
summit/common/context_processors.py (+17/-1)
summit/lpc_settings.py (+33/-0)
summit/schedule/forms.py (+18/-8)
summit/schedule/models/meetingmodel.py (+8/-3)
summit/schedule/templates/schedule/by_participant.html (+1/-1)
summit/schedule/templates/schedule/by_room.html (+1/-1)
summit/schedule/templates/schedule/by_track.html (+1/-1)
summit/schedule/templates/schedule/daily.html (+1/-1)
summit/schedule/templates/schedule/schedule_list.html (+1/-1)
summit/schedule/templates/schedule/summit.html (+1/-1)
summit/schedule/templates/schedule/tracks.html (+2/-2)
summit/settings.py (+1/-0)
To merge this branch: bzr merge lp:~cjohnston/summit/track-display-name
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Adnane Belmadiaf Approve
Review via email: mp+151846@code.launchpad.net

Commit message

Adds lpc_settings.py
Creates settings.TRACK_DISPLAY_NAME andd settings.TRACK_DISPLAY_NAME_PLURAL
Creates a track_display_name template context processor
Switches the name "Track" in the templates to use the new TRACK_DISPLAY_NAME or TRACK_DISPLAY_NAME_PLURAL template context processor

Description of the change

LPC uses the term "Microconf" instead of "Track." This creates a need to us to be able to support different naming conventions without creating a delta between the summit installs.

Also commits an lpc_settings.py

To post a comment you must log in.
Revision history for this message
Adnane Belmadiaf (daker) wrote :

+1 from me

review: Approve
503. By Chris Johnston

Adds TRACK_DISPLAY_NAME_PLURAL

Revision history for this message
Adnane Belmadiaf (daker) wrote :

+1

review: Approve
Revision history for this message
Michael Hall (mhall119) wrote :

Use just one context processor for both, and provide fallback values in case it's not in settings.py:

def track_display_name(request):
    """
    Adds the track display name from settings
    """
    display = getattr(settings, 'TRACK_DISPLAY_NAME', 'Track')
    display_plural = getattr(settings, 'TRACK_DISPLAY_NAME_PLURAL', display+'s')
    return {
        'TRACK_DISPLAY_NAME': display,
        'TRACK_DISPLAY_NAME_PLURAL': display_plural.
    }

504. By Chris Johnston

Makes changes per mhall119s suggestion

Revision history for this message
Michael Hall (mhall119) wrote :

Not just removed the variable from settings.py, since it'll default to those values anyway, and all will be good

505. By Chris Johnston

More fixes per mhall119

Revision history for this message
Michael Hall (mhall119) wrote :

Line 156 of the diff:

verbose_name=settings.TRACK_DISPLAY_NAME,

Needs to be:

verbose_name=getattr(settings, 'TRACK_DISPLAY_NAME', 'Track')

review: Needs Fixing
506. By Chris Johnston

Final fix

Revision history for this message
Michael Hall (mhall119) wrote :

Looks good now

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/common/context_processors.py'
2--- summit/common/context_processors.py 2013-02-26 19:31:21 +0000
3+++ summit/common/context_processors.py 2013-03-09 04:44:20 +0000
4@@ -27,7 +27,7 @@
5
6 def url_base(request):
7 url = request.get_full_path().split('/')
8- return {'url_base':url[1]}
9+ return {'url_base': url[1]}
10
11
12 def next_summit(request):
13@@ -53,3 +53,19 @@
14 return {'main_menu': Menu.on_site.all()[0].slug}
15 except IndexError:
16 return {}
17+
18+
19+def track_display_name(request):
20+ """
21+ Adds the track display name from settings
22+ """
23+ display = getattr(settings, 'TRACK_DISPLAY_NAME', 'Track')
24+ display_plural = getattr(
25+ settings,
26+ 'TRACK_DISPLAY_NAME_PLURAL',
27+ display+'s'
28+ )
29+ return {
30+ 'TRACK_DISPLAY_NAME': display,
31+ 'TRACK_DISPLAY_NAME_PLURAL': display_plural
32+ }
33
34=== added file 'summit/lpc_settings.py'
35--- summit/lpc_settings.py 1970-01-01 00:00:00 +0000
36+++ summit/lpc_settings.py 2013-03-09 04:44:20 +0000
37@@ -0,0 +1,33 @@
38+import os
39+import sys
40+
41+from settings import *
42+
43+SITE_ID = 1
44+
45+try:
46+ import ubuntu_website
47+
48+ INSTALLED_APPS.append('ubuntu_website')
49+
50+ TEMPLATE_CONTEXT_PROCESSORS += (
51+ "ubuntu_website.media_processor",
52+ "ubuntu_website.popup_check",
53+ )
54+ TEMPLATE_DIRS += (
55+ ubuntu_website.TEMPLATE_DIR,
56+ )
57+
58+ THEME_MEDIA = ubuntu_website.MEDIA_ROOT
59+except ImportError:
60+ if not 'init-summit' in sys.argv:
61+ print "You will need to run ./manage.py init-summit"
62+ "to make The Summit Scheduler fully work."
63+ else:
64+ pass
65+
66+# Days before the start of the summit when we stop allowing
67+# track leads to edit the schedule
68+TRACK_LEAD_SCHEDULE_BLACKOUT = 0
69+TRACK_DISPLAY_NAME = 'Microconf'
70+TRACK_DISPLAY_NAME_PLURAL = 'Microconfs'
71
72=== modified file 'summit/schedule/forms.py'
73--- summit/schedule/forms.py 2013-03-04 21:48:31 +0000
74+++ summit/schedule/forms.py 2013-03-09 04:44:20 +0000
75@@ -26,7 +26,10 @@
76 class MultipleAttendeeField(forms.ModelMultipleChoiceField):
77 def label_from_instance(self, obj):
78 return u"%s %s (%s)" % (
79- obj.user.first_name, obj.user.last_name, obj.user.username)
80+ obj.user.first_name,
81+ obj.user.last_name,
82+ obj.user.username
83+ )
84
85
86 class MeetingFormBase(forms.ModelForm):
87@@ -34,7 +37,8 @@
88 queryset=Attendee.objects.all,
89 widget=forms.CheckboxSelectMultiple,
90 label='Participants',
91- required=False)
92+ required=False
93+ )
94
95 class Media:
96 css = {'all': ('/media/css/colortip-1.0-jquery.css',)}
97@@ -57,9 +61,12 @@
98
99 summit = self.instance.summit
100 self.fields['participants'].queryset = Attendee.objects.filter(
101- summit=summit).order_by('user__first_name',
102- 'user__last_name',
103- 'user__username')
104+ summit=summit
105+ ).order_by(
106+ 'user__first_name',
107+ 'user__last_name',
108+ 'user__username'
109+ )
110
111 def save(self, commit=True):
112 instance = super(MeetingFormBase, self).save(commit)
113@@ -76,8 +83,11 @@
114 # This is where we actually link the pizza with toppings
115 instance.participants.clear()
116 for participant in self.cleaned_data['participants']:
117- record = Participant(meeting=instance, attendee=participant,
118- participation='INTERESTED')
119+ record = Participant(
120+ meeting=instance,
121+ attendee=participant,
122+ participation='INTERESTED'
123+ )
124 record.save()
125 self.save_m2m = save_m2m
126
127@@ -193,7 +203,7 @@
128 YOUTUBE_SHORT_URL = re.compile(r'https?:\/\/youtu.be\/(?P<youtube_id>[^\?]*).*')
129
130 class YouTubeEmbedURL(forms.URLField):
131-
132+
133 def clean(self, value):
134 match_html = YOUTUBE_EMBED_HTML.match(value)
135 match_page = YOUTUBE_PAGE_URL.match(value)
136
137=== modified file 'summit/schedule/models/meetingmodel.py'
138--- summit/schedule/models/meetingmodel.py 2013-03-04 19:23:37 +0000
139+++ summit/schedule/models/meetingmodel.py 2013-03-09 04:44:20 +0000
140@@ -19,6 +19,7 @@
141 from urlparse import urlparse
142 from datetime import datetime
143
144+from django.conf import settings
145 from django.db import models
146 from django.core.exceptions import ObjectDoesNotExist
147 from django.core.urlresolvers import reverse
148@@ -129,7 +130,11 @@
149 )
150 # FIXME tracks must be for the same summit
151 # (will require js magic in admin to refresh the boxes)
152- tracks = models.ManyToManyField(Track, blank=True)
153+ tracks = models.ManyToManyField(
154+ Track,
155+ verbose_name=getattr(settings, 'TRACK_DISPLAY_NAME', 'Track'),
156+ blank=True
157+ )
158 spec_url = models.URLField(
159 blank=True,
160 verbose_name="Spec URL"
161@@ -656,7 +661,7 @@
162
163 return missing
164
165- def try_schedule(self, with_interested = False):
166+ def try_schedule(self, with_interested=False):
167 """Try to schedule this meeting in a suitable room."""
168 if self.private:
169 print "Not scheduling private meeting: %s" % self
170@@ -676,7 +681,7 @@
171 if not self.try_schedule_into(rooms):
172 print "Gave up scheduling %s" % self
173
174- def try_schedule_into(self, rooms, with_interested = False):
175+ def try_schedule_into(self, rooms, with_interested=False):
176 """Try to schedule this meeting in one of the given rooms."""
177 today = datetime.now()
178 for room in rooms:
179
180=== modified file 'summit/schedule/templates/schedule/by_participant.html'
181--- summit/schedule/templates/schedule/by_participant.html 2013-01-10 21:37:16 +0000
182+++ summit/schedule/templates/schedule/by_participant.html 2013-03-09 04:44:20 +0000
183@@ -56,7 +56,7 @@
184 {% endfor %}</div>
185 {% endif %}
186 {% if agenda.meeting.tracks.count > 0 %}
187- <br /><b>Tracks:</b>
188+ <br /><b>{{ TRACK_DISPLAY_NAME_PLURAL }}:</b>
189 <ul>{% for track in agenda.meeting.tracks.all %}
190 <li style="color: #{{track.color}};">{{ track.title }}</li>
191 {% endfor %}</ul>
192
193=== modified file 'summit/schedule/templates/schedule/by_room.html'
194--- summit/schedule/templates/schedule/by_room.html 2013-03-04 18:40:11 +0000
195+++ summit/schedule/templates/schedule/by_room.html 2013-03-09 04:44:20 +0000
196@@ -62,7 +62,7 @@
197 {% endfor %}</div>
198 {% endif %}
199 {% if agenda.meeting.tracks.count > 0 %}
200- <br /><b>Tracks:</b>
201+ <br /><b>{{ TRACK_DISPLAY_NAME_PLURAL }}:</b>
202 <ul>{% for track in agenda.meeting.tracks.all %}
203 <li style="color: #{{track.color}};">{{ track.title }}</li>
204 {% endfor %}</ul>
205
206=== modified file 'summit/schedule/templates/schedule/by_track.html'
207--- summit/schedule/templates/schedule/by_track.html 2013-03-04 18:40:11 +0000
208+++ summit/schedule/templates/schedule/by_track.html 2013-03-09 04:44:20 +0000
209@@ -57,7 +57,7 @@
210 {% endfor %}</div>
211 {% endif %}
212 {% if agenda.meeting.tracks.count > 0 %}
213- <br /><b>Tracks:</b>
214+ <br /><b>{{ TRACK_DISPLAY_NAME_PLURAL }}:</b>
215 <ul>{% for track in agenda.meeting.tracks.all %}
216 <li style="color: #{{track.color}};">{{ track.title }}</li>
217 {% endfor %}</ul>
218
219=== modified file 'summit/schedule/templates/schedule/daily.html'
220--- summit/schedule/templates/schedule/daily.html 2013-03-04 18:40:11 +0000
221+++ summit/schedule/templates/schedule/daily.html 2013-03-09 04:44:20 +0000
222@@ -84,7 +84,7 @@
223 {% endfor %}</div>
224 {% endif %}
225 {% if agenda.meeting.tracks.count > 0 %}
226- <br /><b>Tracks:</b>
227+ <br /><b>{{ TRACK_DISPLAY_NAME_PLURAL }}:</b>
228 <ul>{% for track in agenda.meeting.tracks.all %}
229 <li style="color: #{{track.color}};">{{ track.title }}</li>
230 {% endfor %}</ul>
231
232=== modified file 'summit/schedule/templates/schedule/schedule_list.html'
233--- summit/schedule/templates/schedule/schedule_list.html 2012-04-12 13:43:12 +0000
234+++ summit/schedule/templates/schedule/schedule_list.html 2013-03-09 04:44:20 +0000
235@@ -15,7 +15,7 @@
236 </li>
237 <li>
238 <div id="column-schedule-inner">
239-By track:
240+ By {{ TRACK_DISPLAY_NAME }}:
241 <ul>
242 {% for track in tracks %}
243 <li><a href="/{{ summit.name }}/track/{{ track.slug|lower }}">{{ track.title }}</a></li>
244
245=== modified file 'summit/schedule/templates/schedule/summit.html'
246--- summit/schedule/templates/schedule/summit.html 2012-10-10 16:02:28 +0000
247+++ summit/schedule/templates/schedule/summit.html 2013-03-09 04:44:20 +0000
248@@ -18,7 +18,7 @@
249 <meta itemprop="description" content="{{ summit.description|linebreaks|striptags }}" />{% endblock %}
250
251 {% block sub_nav_links %}
252- <li><a class="sub-nav-item" href="/{{ summit.name }}/tracks" title="Tracks">Tracks</a></li>
253+<li><a class="sub-nav-item" href="/{{ summit.name }}/tracks" title="{{ TRACK_DISPLAY_NAME_PLURAL }}">{{ TRACK_DISPLAY_NAME_PLURAL }}</a></li>
254 <li><a class="sub-nav-item" href="/{{ summit.name }}.ical">All sessions (iCal)</a></li>
255 <li><a class="sub-nav-item" href="{% url summit.schedule.views.past %}">Past summits</a></li>
256 {% endblock %}
257
258=== modified file 'summit/schedule/templates/schedule/tracks.html'
259--- summit/schedule/templates/schedule/tracks.html 2012-04-18 21:51:05 +0000
260+++ summit/schedule/templates/schedule/tracks.html 2013-03-09 04:44:20 +0000
261@@ -1,12 +1,12 @@
262 {% extends "base.html" %}
263 {% load markup %}
264-{% block page_name %}{{ summit.title }} Tracks{%endblock %}
265+{% block page_name %}{{ summit.title }} {{ TRACK_DISPLAY_NAME_PLURAL }}{%endblock %}
266 {% block sub_nav %}{% endblock %}
267
268 {% block content %}
269 <div class="row">
270 <div class="span-12">
271- <h1>{{ summit.title }} Tracks</h1>
272+ <h1>{{ summit.title }} {{ TRACK_DISPLAY_NAME_PLURAL }}</h1>
273 </div>
274 </div>
275
276
277=== modified file 'summit/settings.py'
278--- summit/settings.py 2013-03-08 22:04:36 +0000
279+++ summit/settings.py 2013-03-09 04:44:20 +0000
280@@ -101,6 +101,7 @@
281 "common.context_processors.url_base",
282 "common.context_processors.summit_version",
283 "common.context_processors.site_menu",
284+ "common.context_processors.track_display_name",
285 )
286
287 MIDDLEWARE_CLASSES = (

Subscribers

People subscribed via source and target branches