Merge lp:~daker/loco-team-portal/fix.579833 into lp:loco-team-portal
- fix.579833
- Merge into 0.2
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Hall | ||||
Approved revision: | 268 | ||||
Merged at revision: | 271 | ||||
Proposed branch: | lp:~daker/loco-team-portal/fix.579833 | ||||
Merge into: | lp:loco-team-portal | ||||
Diff against target: |
371 lines (+279/-1) 8 files modified
loco_directory/common/context_processors.py (+11/-0) loco_directory/media/css/jquery.lightbox-0.5.css (+101/-0) loco_directory/media/js/jquery.lightbox-0.5.min.js (+42/-0) loco_directory/settings.py (+4/-0) loco_directory/teams/migrations/0008_flickr_account.py (+67/-0) loco_directory/teams/models.py (+2/-0) loco_directory/templates/base.html (+1/-1) loco_directory/templates/teams/team_detail.html (+51/-0) |
||||
To merge this branch: | bzr merge lp:~daker/loco-team-portal/fix.579833 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Hall (community) | Approve | ||
Daniel Holbach (community) | Needs Fixing | ||
Adnane Belmadiaf | Needs Resubmitting | ||
Review via email: mp+33701@code.launchpad.net |
Commit message
Description of the change
Adnane Belmadiaf (daker) wrote : | # |
Oki done!!
Daniel Holbach (dholbach) wrote : | # |
I'm not sure. Do we want to use a 'public' API key? After all it's readable from the source code. Apart from that, total thumbs up!
Adnane Belmadiaf (daker) wrote : | # |
We need the API key to get the json dump, it will appear on the source code because the dump is rendered with the jQuery framework.
- 264. By Michael Hall
-
Add User Profiles, merge from Daniel Holbach
- 265. By Michael Hall
-
Redesign of Global Events to match Team Event redesign, merge from Chris Johnston
- 266. By Michael Hall
-
More profiles from Daniel Holbach
- 267. By Michael Hall
-
Team Details cleanup, merge from Martin Owens
Michael Hall (mhall119) wrote : | # |
Did you manually edit loco_directory/
Daniel Holbach (dholbach) wrote : | # |
I know we need the API key, but I'd prefer if people set it 'manually' in local_settings.py (like the Google API key), so we don't share 'our' flickr key publicly (in bazaar and Launchpad). I hope I'm less confusing now. :-)
Adnane Belmadiaf (daker) wrote : | # |
> Did you manually edit loco_directory/
The first time yes in rev 261, i have undo the changes then i have created the migration script in rev 262
> I know we need the API key, but I'd prefer if people set it 'manually' in
> local_settings.py (like the Google API key), so we don't share 'our' flickr
> key publicly (in bazaar and Launchpad). I hope I'm less confusing now. :-)
i have done this, you can set it manualy (like the Google API key) rev 262, just one thing that the API key will be shown in the source code (when the user hit "View Source" in the browser) for only one reason that the process is made on the client side.
Daniel Holbach (dholbach) wrote : | # |
Can you resolve the conflict in loco_directory/
Apart from that everything should be fine.
- 268. By Adnane Belmadiaf
-
* Resolved conflict in templates/
teams/team_ detail. html
* Renamed the flickr account migration script - 269. By Adnane Belmadiaf
-
* Changed the number of flickr photos from 25 to 27
Michael Hall (mhall119) wrote : | # |
Looks fantastic!
Preview Diff
1 | === modified file 'loco_directory/common/context_processors.py' |
2 | --- loco_directory/common/context_processors.py 2010-07-28 13:13:39 +0000 |
3 | +++ loco_directory/common/context_processors.py 2010-09-01 16:44:42 +0000 |
4 | @@ -26,6 +26,17 @@ |
5 | google_api_key = "" |
6 | return {'google_api_key': google_api_key} |
7 | |
8 | +def flickr_api_key(request): |
9 | + """ |
10 | + Return the Flickr API Key or "" if none is defined. |
11 | + """ |
12 | + |
13 | + try: |
14 | + flickr_api_key = settings.FLICKR_API_KEY |
15 | + except AttributeError: |
16 | + flickr_api_key = "" |
17 | + return {'flickr_api_key': flickr_api_key} |
18 | + |
19 | def login_redirect(request): |
20 | return {'login_next': request.get_full_path()} |
21 | |
22 | |
23 | === added file 'loco_directory/media/css/jquery.lightbox-0.5.css' |
24 | --- loco_directory/media/css/jquery.lightbox-0.5.css 1970-01-01 00:00:00 +0000 |
25 | +++ loco_directory/media/css/jquery.lightbox-0.5.css 2010-09-01 16:44:42 +0000 |
26 | @@ -0,0 +1,101 @@ |
27 | +/** |
28 | + * jQuery lightBox plugin |
29 | + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) |
30 | + * and adapted to me for use like a plugin from jQuery. |
31 | + * @name jquery-lightbox-0.5.css |
32 | + * @author Leandro Vieira Pinho - http://leandrovieira.com |
33 | + * @version 0.5 |
34 | + * @date April 11, 2008 |
35 | + * @category jQuery plugin |
36 | + * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) |
37 | + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US |
38 | + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin |
39 | + */ |
40 | +#jquery-overlay { |
41 | + position: absolute; |
42 | + top: 0; |
43 | + left: 0; |
44 | + z-index: 90; |
45 | + width: 100%; |
46 | + opacity:.5; |
47 | +} |
48 | +#jquery-lightbox { |
49 | + position: absolute; |
50 | + top: 0; |
51 | + left: 0; |
52 | + width: 100%; |
53 | + z-index: 100; |
54 | + text-align: center; |
55 | + line-height: 0; |
56 | +} |
57 | +#jquery-lightbox a img { border: none; } |
58 | +#lightbox-container-image-box { |
59 | + position: relative; |
60 | + background-color: #fff; |
61 | + width: 250px; |
62 | + height: 250px; |
63 | + margin: 0 auto; |
64 | +} |
65 | +#lightbox-container-image { padding: 10px; } |
66 | +#lightbox-loading { |
67 | + position: absolute; |
68 | + top: 40%; |
69 | + left: 0%; |
70 | + height: 25%; |
71 | + width: 100%; |
72 | + text-align: center; |
73 | + line-height: 0; |
74 | +} |
75 | +#lightbox-nav { |
76 | + position: absolute; |
77 | + top: 0; |
78 | + left: 0; |
79 | + height: 100%; |
80 | + width: 100%; |
81 | + z-index: 10; |
82 | +} |
83 | +#lightbox-container-image-box > #lightbox-nav { left: 0; } |
84 | +#lightbox-nav a { outline: none;} |
85 | +#lightbox-nav-btnPrev, #lightbox-nav-btnNext { |
86 | + width: 49%; |
87 | + height: 100%; |
88 | + zoom: 1; |
89 | + display: block; |
90 | +} |
91 | +#lightbox-nav-btnPrev { |
92 | + left: 0; |
93 | + float: left; |
94 | +} |
95 | +#lightbox-nav-btnNext { |
96 | + right: 0; |
97 | + float: right; |
98 | +} |
99 | +#lightbox-container-image-data-box { |
100 | + font: 10px Verdana, Helvetica, sans-serif; |
101 | + background-color: #fff; |
102 | + margin: 0 auto; |
103 | + line-height: 1.4em; |
104 | + overflow: auto; |
105 | + width: 100%; |
106 | + padding: 0 10px 0; |
107 | +} |
108 | +#lightbox-container-image-data { |
109 | + padding: 0 10px; |
110 | + color: #666; |
111 | +} |
112 | +#lightbox-container-image-data #lightbox-image-details { |
113 | + width: 70%; |
114 | + float: left; |
115 | + text-align: left; |
116 | +} |
117 | +#lightbox-image-details-caption { font-weight: bold; } |
118 | +#lightbox-image-details-currentNumber { |
119 | + display: block; |
120 | + clear: left; |
121 | + padding-bottom: 1.0em; |
122 | +} |
123 | +#lightbox-secNav-btnClose { |
124 | + width: 66px; |
125 | + float: right; |
126 | + padding-bottom: 0.7em; |
127 | +} |
128 | |
129 | === added file 'loco_directory/media/img/lightbox-blank.gif' |
130 | Binary files loco_directory/media/img/lightbox-blank.gif 1970-01-01 00:00:00 +0000 and loco_directory/media/img/lightbox-blank.gif 2010-09-01 16:44:42 +0000 differ |
131 | === added file 'loco_directory/media/img/lightbox-btn-close.gif' |
132 | Binary files loco_directory/media/img/lightbox-btn-close.gif 1970-01-01 00:00:00 +0000 and loco_directory/media/img/lightbox-btn-close.gif 2010-09-01 16:44:42 +0000 differ |
133 | === added file 'loco_directory/media/img/lightbox-btn-next.gif' |
134 | Binary files loco_directory/media/img/lightbox-btn-next.gif 1970-01-01 00:00:00 +0000 and loco_directory/media/img/lightbox-btn-next.gif 2010-09-01 16:44:42 +0000 differ |
135 | === added file 'loco_directory/media/img/lightbox-btn-prev.gif' |
136 | Binary files loco_directory/media/img/lightbox-btn-prev.gif 1970-01-01 00:00:00 +0000 and loco_directory/media/img/lightbox-btn-prev.gif 2010-09-01 16:44:42 +0000 differ |
137 | === added file 'loco_directory/media/img/lightbox-ico-loading.gif' |
138 | Binary files loco_directory/media/img/lightbox-ico-loading.gif 1970-01-01 00:00:00 +0000 and loco_directory/media/img/lightbox-ico-loading.gif 2010-09-01 16:44:42 +0000 differ |
139 | === added file 'loco_directory/media/js/jquery.lightbox-0.5.min.js' |
140 | --- loco_directory/media/js/jquery.lightbox-0.5.min.js 1970-01-01 00:00:00 +0000 |
141 | +++ loco_directory/media/js/jquery.lightbox-0.5.min.js 2010-09-01 16:44:42 +0000 |
142 | @@ -0,0 +1,42 @@ |
143 | +/** |
144 | + * jQuery lightBox plugin |
145 | + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/) |
146 | + * and adapted to me for use like a plugin from jQuery. |
147 | + * @name jquery-lightbox-0.5.js |
148 | + * @author Leandro Vieira Pinho - http://leandrovieira.com |
149 | + * @version 0.5 |
150 | + * @date April 11, 2008 |
151 | + * @category jQuery plugin |
152 | + * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com) |
153 | + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US |
154 | + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin |
155 | + */ |
156 | +(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'/media/img/lightbox-ico-loading.gif',imageBtnPrev:'/media/img/lightbox-btn-prev.gif',imageBtnNext:'/media/img/lightbox-btn-next.gif',imageBtnClose:'/media/img/lightbox-btn-close.gif',imageBlank:'/media/img/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;} |
157 | +function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}} |
158 | +while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;} |
159 | +_set_image_to_view();} |
160 | +function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});} |
161 | +function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();} |
162 | +var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}} |
163 | +$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();} |
164 | +if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}} |
165 | +function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}} |
166 | +if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}} |
167 | +_enable_keyboard_navigation();} |
168 | +function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});} |
169 | +function _disable_keyboard_navigation(){$(document).unbind();} |
170 | +function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;} |
171 | +key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();} |
172 | +if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}} |
173 | +if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}} |
174 | +function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];} |
175 | +if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}} |
176 | +function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});} |
177 | +function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;} |
178 | +var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;} |
179 | +windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;} |
180 | +if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;} |
181 | +if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;} |
182 | +arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;} |
183 | +arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();} |
184 | +while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery); |
185 | |
186 | === modified file 'loco_directory/settings.py' |
187 | --- loco_directory/settings.py 2010-08-23 08:35:14 +0000 |
188 | +++ loco_directory/settings.py 2010-09-01 16:44:42 +0000 |
189 | @@ -84,6 +84,7 @@ |
190 | "django.core.context_processors.media", |
191 | "common.context_processors.loco_version", |
192 | "common.context_processors.google_api_key", |
193 | + "common.context_processors.flickr_api_key", |
194 | "common.context_processors.login_redirect", |
195 | "common.context_processors.url_base", |
196 | ) |
197 | @@ -148,6 +149,9 @@ |
198 | LOGIN_URL = '/openid/login' |
199 | LOGIN_REDIRECT_URL = '/' |
200 | |
201 | + |
202 | +FLICKR_API_KEY = '8c969a1e8a49629bb89b411930ab1cc8' |
203 | + |
204 | import logging |
205 | try: |
206 | from local_settings import * |
207 | |
208 | === added file 'loco_directory/teams/migrations/0008_flickr_account.py' |
209 | --- loco_directory/teams/migrations/0008_flickr_account.py 1970-01-01 00:00:00 +0000 |
210 | +++ loco_directory/teams/migrations/0008_flickr_account.py 2010-09-01 16:44:42 +0000 |
211 | @@ -0,0 +1,67 @@ |
212 | + |
213 | +from south.db import db |
214 | +from django.db import models |
215 | +from teams.models import * |
216 | + |
217 | +class Migration: |
218 | + |
219 | + def forwards(self, orm): |
220 | + |
221 | + # Adding field 'Team.flickr_id' |
222 | + db.add_column('teams', 'flickr_id', orm['teams.team:flickr_id']) |
223 | + |
224 | + |
225 | + |
226 | + def backwards(self, orm): |
227 | + |
228 | + # Deleting field 'Team.flickr_id' |
229 | + db.delete_column('teams', 'flickr_id') |
230 | + |
231 | + |
232 | + |
233 | + models = { |
234 | + 'teams.continent': { |
235 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
236 | + 'name': ('django.db.models.fields.TextField', [], {'max_length': '50'}) |
237 | + }, |
238 | + 'teams.country': { |
239 | + 'continents': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['teams.Continent']"}), |
240 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
241 | + 'name': ('django.db.models.fields.TextField', [], {'max_length': '100'}) |
242 | + }, |
243 | + 'teams.language': { |
244 | + 'code': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True'}), |
245 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
246 | + 'name': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True'}) |
247 | + }, |
248 | + 'teams.team': { |
249 | + 'Meta': {'db_table': "'teams'"}, |
250 | + 'admins': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['teams.TeamAdministrator']"}), |
251 | + 'approved': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), |
252 | + 'approved_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), |
253 | + 'city': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), |
254 | + 'countries': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['teams.Country']"}), |
255 | + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), |
256 | + 'expires_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}), |
257 | + 'flickr_id': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}), |
258 | + 'forum_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), |
259 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
260 | + 'irc_chan': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}), |
261 | + 'languages': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['teams.Language']"}), |
262 | + 'lp_name': ('django.db.models.fields.SlugField', [], {'max_length': '40', 'null': 'True', 'db_index': 'True'}), |
263 | + 'ml_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), |
264 | + 'mugshot_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), |
265 | + 'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True'}), |
266 | + 'owner': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'null': 'True', 'db_index': 'True'}), |
267 | + 'provides_support': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), |
268 | + 'spr': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}), |
269 | + 'web_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), |
270 | + 'wiki_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) |
271 | + }, |
272 | + 'teams.teamadministrator': { |
273 | + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), |
274 | + 'lpid': ('django.db.models.fields.SlugField', [], {'max_length': '40', 'db_index': 'True'}) |
275 | + } |
276 | + } |
277 | + |
278 | + complete_apps = ['teams'] |
279 | |
280 | === modified file 'loco_directory/teams/models.py' |
281 | --- loco_directory/teams/models.py 2010-08-18 15:29:01 +0000 |
282 | +++ loco_directory/teams/models.py 2010-09-01 16:44:42 +0000 |
283 | @@ -85,6 +85,8 @@ |
284 | contact_profiles = models.ManyToManyField(UserProfile, related_name='contacts') |
285 | mugshot_url = models.URLField(_("URL of mugshot"), verify_exists=False, null=True, blank=True) |
286 | languages = models.ManyToManyField(Language) |
287 | + flickr_id = models.CharField(_("Flickr User ID"), max_length=20, null=True, blank=True, |
288 | + help_text=_("To get your Flickr user id go to http://idgettr.com. Ex. 47353004@N03")) |
289 | |
290 | objects = TeamManager() |
291 | |
292 | |
293 | === modified file 'loco_directory/templates/base.html' |
294 | --- loco_directory/templates/base.html 2010-08-26 00:00:52 +0000 |
295 | +++ loco_directory/templates/base.html 2010-09-01 16:44:42 +0000 |
296 | @@ -14,7 +14,7 @@ |
297 | <a class="main-nav-item {% ifequal url_base 'events' %}current{% endifequal %}" title="{% trans "Show All Events" %}" href="{% url event-list %}">{% trans "Events" %}</a> |
298 | <a class="main-nav-item {% ifequal url_base 'loco-council' %}current{% endifequal %}" title="{% trans "LoCo Council" %}" href="{% url loco_council %}">{% trans "LoCo Council" %}</a> |
299 | <a class="main-nav-item {% ifequal url_base 'about-loco' %}current{% endifequal %}" title="{% trans "About LoCo Teams" %}" href="{% url about_loco %}">{% trans "About LoCos" %}</a></li> |
300 | - <a class="main-nav-item {% ifequal url_base 'irc_chat' %}current{% endifequal %}" title="{% trans "IRC Chat" %}" href="{% url irc_chat %}">{% trans "IRC Chat" %}</a></li> |
301 | + <a class="main-nav-item {% ifequal url_base 'irc' %}current{% endifequal %}" title="{% trans "IRC Chat" %}" href="{% url irc_chat %}">{% trans "IRC Chat" %}</a></li> |
302 | {% if user.is_authenticated %} |
303 | <a class="main-nav-item" href="/logout" title="{% trans "Log Out" %}: {{ user.username }}">{% trans "Log Out" %}</a> |
304 | {% else %} |
305 | |
306 | === modified file 'loco_directory/templates/teams/team_detail.html' |
307 | --- loco_directory/templates/teams/team_detail.html 2010-08-28 18:06:01 +0000 |
308 | +++ loco_directory/templates/teams/team_detail.html 2010-09-01 16:44:42 +0000 |
309 | @@ -13,6 +13,48 @@ |
310 | {% block search %}{% endblock %} |
311 | |
312 | {% block extrahead %} |
313 | +{% if team.flickr_id %} |
314 | +<script type="text/javascript" src="{{MEDIA_URL}}jquery/jquery.js"></script> |
315 | +<script type="text/javascript" src="{{MEDIA_URL}}js/jquery.lightbox-0.5.min.js"></script> |
316 | +<link rel="stylesheet" href="{{MEDIA_URL}}css/jquery.lightbox-0.5.css" type="text/css" media="screen" /> |
317 | +<script type="text/javascript"> |
318 | +$(function() { |
319 | + var apiKey = '{{ flickr_api_key }}'; |
320 | + var userId = '{{ team.flickr_id }}'; |
321 | + var tag = ''; |
322 | + var perPage = '27'; |
323 | + |
324 | + $.getJSON('http://api.flickr.com/services/rest/?format=json&method='+ |
325 | + 'flickr.photos.search&api_key=' + apiKey + '&user_id=' + userId + |
326 | + '&tags=' + tag + '&per_page=' + perPage + '&jsoncallback=?', |
327 | + function(data){ |
328 | + $.each(data.photos.photo, function(i, rPhoto){ |
329 | + var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/' |
330 | + + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret; |
331 | + |
332 | + var thumbPhotoURL = basePhotoURL + '_s.jpg'; |
333 | + var mediumPhotoURL = basePhotoURL + '.jpg'; |
334 | + |
335 | + var photoStringStart = '<a class="lightbox" '; |
336 | + var photoStringEnd = 'title="' + rPhoto.title + '" href="'+ |
337 | + mediumPhotoURL +'"><img src="' + thumbPhotoURL + '" alt="' + |
338 | + rPhoto.title + '"/></a>;'; |
339 | + var photoString = photoStringStart + photoStringEnd |
340 | + |
341 | + $(photoString).appendTo("#flickr"); |
342 | + }); |
343 | + $("a.lightbox").lightBox(); |
344 | + }); |
345 | +}); |
346 | +</script> |
347 | +<style type="text/css"> |
348 | +div#flickr a.lightbox img { |
349 | + border: 5px solid #b3aaa4; |
350 | + margin-left: 5px; |
351 | + margin-right: 5px; |
352 | +} |
353 | +</style> |
354 | +{% endif %} |
355 | <link type="application/rss+xml" rel="alternate" title="{% trans "Team Events (RSS)" %}" href="{% url team-events-rss team.lp_name %}" /> |
356 | {% endblock %} |
357 | |
358 | @@ -122,4 +164,13 @@ |
359 | <img id="locobranding" src="{{ team.mugshot_url }}" alt="" title="{{ team.name }}"/> |
360 | </article> |
361 | |
362 | +{% if team.flickr_id %} |
363 | +<article class="minor-content alone" style="width:95%;"> |
364 | +<h2>Flickr Photos</a></h2> |
365 | +<div style="width:100%;" id="flickr"> </div> |
366 | +</article> |
367 | +{% endif %} |
368 | + |
369 | + |
370 | + |
371 | {% endblock %} |
- This model change requires a separate new migration script. Have a look at ./manage.py startmigration <...>
- Can we make the api key configurable like the google api key?
Apart from that: nice work!