Changeset b329804
- Timestamp:
- 05/02/12 16:07:35 (13 months ago)
- Branches:
- master, crem, crem2, dev, diadems, generic, instru_search, lam, nlivemulti, release/1.4.4, security, social, storage, test
- Children:
- d68b189, 03ca023
- Parents:
- 7a49503 (diff), cd6363d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Guillaume Pellerin <yomguy@…> (05/02/12 16:07:35)
- git-committer:
- Guillaume Pellerin <yomguy@…> (05/02/12 16:07:35)
- Files:
-
- 7 edited
-
tools/dev/push.sh (modified) (1 diff)
-
README.rst (modified) (1 diff)
-
telemeta/models/media.py (modified) (1 diff)
-
telemeta/models/query.py (modified) (5 diffs)
-
telemeta/templates/telemeta/search_criteria.html (modified) (1 diff)
-
telemeta/templates/telemeta/search_results.html (modified) (1 diff)
-
telemeta/views/base.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tools/dev/push.sh
r28fa06b rcd6363d 22 22 #echo "Update jimi.parisson.com:" 23 23 echo "Update angus.parisson.com:" 24 ssh angus.parisson.com "cd /home/telemeta/telemeta- prod; git pull origin production; \25 cd /home/telemeta/telemeta ; git pull origin master; \24 ssh angus.parisson.com "cd /home/telemeta/telemeta-master; git pull origin master; \ 25 cd /home/telemeta/telemeta-develop; git pull origin develop; \ 26 26 cd /home/telemeta/demo/; ./manage.py migrate telemeta --delete-ghost-migrations; 27 27 cd /home/telemeta/sandbox/; ./manage.py migrate telemeta --delete-ghost-migrations; -
README.rst
r0d62fe4 r04ec884 191 191 * MMSH : Maison Méditerranéenne des Sciences de l'Homme 192 192 http://www.mmsh.univ-aix.fr/ 193 -
telemeta/models/media.py
r2444cce r20ef7d8 412 412 title += ' ' + self.track 413 413 return title 414 415 @property 416 def instruments(self): 417 "Return the instruments of the item" 418 instruments = [] 419 performances = MediaItemPerformance.objects.filter(media_item=self) 420 for performance in performances: 421 instrument = performance.instrument 422 alias = performance.alias 423 if not instrument in instruments: 424 instruments.append(instrument) 425 if not alias in instruments: 426 instruments.append(alias) 427 428 instruments.sort(self.__name_cmp) 429 return instruments 430 431 instruments.verbose_name = _("instruments") 414 432 415 433 -
telemeta/models/query.py
r2f57f0e rc9f9871 201 201 return self.filter(file__contains='/') 202 202 203 def by_instrument(self, instrument): 204 "Find items by instrument" 205 return self.filter(instruments__in=instrument) 206 203 207 204 208 class MediaItemManager(CoreManager): … … 244 248 return self.get_query_set().sound(*args, **kwargs) 245 249 sound.__doc__ = MediaItemQuerySet.sound.__doc__ 250 251 def by_instrument(self, *args, **kwargs): 252 return self.get_query_set().by_instrument(*args, **kwargs) 253 by_instrument.__doc__ = MediaItemQuerySet.by_instrument.__doc__ 246 254 247 255 … … 332 340 return self.filter(items__file__contains='/').distinct() 333 341 342 def by_instrument(self, instrument): 343 "Find collections by instrument" 344 return self.filter(items__instruments__in=instrument).distinct() 345 334 346 335 347 class MediaCollectionManager(CoreManager): … … 375 387 return self.get_query_set().sound(*args, **kwargs) 376 388 sound.__doc__ = MediaCollectionQuerySet.sound.__doc__ 389 390 def by_instrument(self, *args, **kwargs): 391 return self.get_query_set().by_instrument(*args, **kwargs) 392 by_instrument.__doc__ = MediaCollectionQuerySet.by_instrument.__doc__ 377 393 378 394 … … 478 494 return self.get_query_set().quick_search(*args, **kwargs) 479 495 quick_search.__doc__ = MediaFondsQuerySet.quick_search.__doc__ 496 497 498 class InstrumentQuerySet(CoreQuerySet): 499 "Base class for all media instrument query sets" 500 501 def quick_search(self, pattern): 502 "Perform a quick search on text and char fields" 503 from telemeta.models.instrument import Instrument 504 mod = Instrument() 505 pattern = pattern.strip() 506 q = Q(code__contains=pattern) 507 fields = mod.to_dict() 508 keys = fields.keys() 509 for field in keys: 510 field_str = str(mod._meta.get_field(field)) 511 if 'CharField' in field_str or 'TextField' in field_str: 512 q = q | word_search_q(field, pattern) 513 return self.filter(q) 514 515 516 class InstrumentManager(CoreManager): 517 "Manage instrument queries" 518 519 def get_query_set(self): 520 "Return instrument query sets" 521 return InstrumentQuerySet(self.model) 522 523 def quick_search(self, *args, **kwargs): 524 return self.get_query_set().quick_search(*args, **kwargs) 525 quick_search.__doc__ = InstrumentQuerySet.quick_search.__doc__ -
telemeta/templates/telemeta/search_criteria.html
r566f17d rc9f9871 63 63 <label for="location">{% field_label "Location" %}</label> 64 64 <input type="text" name="location" id="location" value="{{ criteria.location }}" /> 65 </p> 66 67 <p> 68 <label for="instrument">{% field_label "Instrument" %}</label> 69 <input type="text" name="instrument" id="instrument" /> 65 70 </p> 66 71 -
telemeta/templates/telemeta/search_results.html
r7baa3c8 rc9f9871 28 28 {% if criteria.location %} 29 29 <li><b>{% field_label "Location" %}:</b> {{criteria.location}}</li> 30 {% endif %} 31 {% if criteria.instrument %} 32 <li><b>{% field_label "Instrument" %}:</b> {{criteria.instrument}}</li> 30 33 {% endif %} 31 34 {% if criteria.ethnic_group %} -
telemeta/views/base.py
r2444cce r42d8c45 344 344 collections.sound(), 345 345 items.sound()), 346 'instrument': lambda value: ( 347 collections.by_instrument(value), 348 items.by_instrument(value)), 346 349 } 347 350 … … 1477 1480 subjects = settings.TELEMETA_SUBJECTS 1478 1481 tags = ['title', 'description', 'comment'] 1479 title = organization + ' - Telemeta - ' + ugettext('Last changes')1482 title = organization.decode('utf8') + ' - Telemeta - ' + ugettext('Last changes') 1480 1483 link = "" 1481 1484 description = ' '.join([subject.decode('utf-8') for subject in subjects])
Note: See TracChangeset
for help on using the changeset viewer.
