Changeset 3130b4d


Ignore:
Timestamp:
Mar 29, 2012 2:31:29 PM (3 years ago)
Author:
yomguy <yomguy@…>
Branches:
master, crem, crem2, dev, dev2, diadems, dj1.6, feature/breadcrumbs, feature/ts-0.5, feature/ts-0.5.4, feature/writecache, generic, instru_search, lam, lam2, mapsv3, merge, nlivemulti, release/1.4.4, sabiod, security, server, social, storage, telecaster, test
Children:
54ee9e2
Parents:
b0fab0a (diff), c1e3f39 (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:
yomguy <yomguy@…> (29/03/2012 14:31:29)
git-committer:
yomguy <yomguy@…> (29/03/2012 14:31:29)
Message:

Merge branch 'master' into dev

Location:
telemeta
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • telemeta/htdocs/css/telemeta.css

    rf95ca3b r8a5b1b5  
    103103 
    104104#header { 
    105     padding: 0.2em 0; 
     105    padding: 0em; 
    106106/*     background: url("../images/waves.png") 100% 0% no-repeat; */ 
    107107} 
     
    471471#menu .red { border-bottom-color:  #DD0000; } 
    472472#menu .violet { border-bottom-color:  #A00020; } 
     473#menu .origin { border-bottom-color: #6a0307; } 
    473474 
    474475* html #menu :link, * html #menu :visited { background-position: 1px 0 } 
  • telemeta/templates/telemeta/base.html

    rfabced9 r8a5b1b5  
    8484<ul id="nav"> 
    8585 {% if user.is_authenticated %} 
    86   <li><a href="#desk#" class="blue">{% trans "Desk" %}</a></span> 
     86  <li><a href="#desk#" class="blue">{% trans "Desk" %}</a> 
    8787   <ul> 
    8888    <li><a href="{% url telemeta-desk-lists %}">{% trans "Lists" %}</a></li> 
     
    9595 {% endif %} 
    9696 
    97  {% block archives %} 
    9897 <li><a href="#archives#" class="green">{% trans "Archives" %}</a> 
    9998  <ul> 
     
    103102    <li><a href="{% url telemeta-items %}">{% trans "Items" %}</a></li> 
    104103  </ul> 
    105   <div class="clear"></div> 
    106104 </li> 
    107  {% endblock archives %} 
    108   
    109  {% block geonav %} 
     105 
    110106 <li><a href="{% url telemeta-geo-continents %}" class="yellow">{% trans "Geo Navigator" %}</a></li> 
    111  {% endblock geonav %} 
    112107 
    113108 <li><a href="{% url telemeta-search-criteria %}" class="orange">{% trans "Advanced search" %}</a></li> 
     
    122117 <li><a href="{% url telemeta-instrument-edit %}">{% trans "Instruments" %}</a></li> 
    123118 </ul> 
    124  <div class="clear"></div> 
    125119 </li> 
    126120{% endif %} 
    127121</ul> 
    128 <div class="clear"></div> 
    129122 
    130 {% endblock %} 
     123{% endblock menu %} 
    131124</div> 
    132125</div> 
     
    155148  <tr> 
    156149   <td> 
    157     <a id="telemeta_powered" href="{% telemeta_url %}" target="_blank"><img src="{% url telemeta-images "logo_mini_2.png" %}" height="30" width="93" 
     150    <a id="telemeta_powered" href="{% telemeta_url %}" target="_blank"><img src="{% url telemeta-images "logo_mini_2.png" %}" 
    158151   alt="Telemeta Powered"/></a> 
    159152    <p class="left"> 
  • telemeta/urls.py

    rb6c6871 r8a5b1b5  
    293293    url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'telemeta/login.html'}, 
    294294        name="telemeta-login"), 
     295    url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'telemeta/login.html'}, 
     296        name="telemeta-login"), 
    295297    #url(r'^login/$', 'ipauth.views.login', {'template_name': 'telemeta/login.html'}, 
    296298    #    name="telemeta-login"), 
  • telemeta/models/media.py

    rfabced9 rbf87cda  
    408408            title += ' ' + self.track 
    409409        return title 
     410 
     411    @property 
     412    def instruments(self): 
     413        "Return the instruments of the item" 
     414        instruments = [] 
     415        performances = MediaItemPerformance.objects.filter(media_item=self) 
     416        for performance in performances: 
     417            instrument = performance.instrument 
     418            alias = performance.alias 
     419            if not instrument in instruments: 
     420                instruments.append(instrument) 
     421            if not alias in instruments: 
     422                instruments.append(alias) 
     423 
     424        instruments.sort(self.__name_cmp) 
     425        return instruments 
     426 
     427        instruments.verbose_name = _("instruments") 
    410428 
    411429 
  • telemeta/models/query.py

    r2f57f0e rc9f9871  
    201201        return self.filter(file__contains='/') 
    202202 
     203    def by_instrument(self, instrument): 
     204        "Find items by instrument" 
     205        return self.filter(instruments__in=instrument) 
     206 
    203207 
    204208class MediaItemManager(CoreManager): 
     
    244248        return self.get_query_set().sound(*args, **kwargs) 
    245249    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__ 
    246254 
    247255 
     
    332340        return self.filter(items__file__contains='/').distinct() 
    333341 
     342    def by_instrument(self, instrument): 
     343        "Find collections by instrument" 
     344        return self.filter(items__instruments__in=instrument).distinct() 
     345 
    334346 
    335347class MediaCollectionManager(CoreManager): 
     
    375387        return self.get_query_set().sound(*args, **kwargs) 
    376388    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__ 
    377393 
    378394 
     
    478494        return self.get_query_set().quick_search(*args, **kwargs) 
    479495    quick_search.__doc__ = MediaFondsQuerySet.quick_search.__doc__ 
     496 
     497 
     498class 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 
     516class 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  
    6363    <label for="location">{% field_label "Location" %}</label> 
    6464    <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" /> 
    6570    </p> 
    6671 
  • telemeta/templates/telemeta/search_results.html

    r7baa3c8 rc9f9871  
    2828  {% if criteria.location %} 
    2929    <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> 
    3033  {% endif %} 
    3134  {% if criteria.ethnic_group %} 
  • telemeta/views/base.py

    r0d2f73e r3c13a83  
    339339                collections.sound(), 
    340340                items.sound()), 
     341            'instrument': lambda value: ( 
     342                collections.by_instrument(value), 
     343                items.by_instrument(value)), 
    341344        } 
    342345 
Note: See TracChangeset for help on using the changeset viewer.