Changeset bf87cda


Ignore:
Timestamp:
Mar 21, 2012 2:44:33 PM (3 years ago)
Author:
yomguy <yomguy@…>
Branches:
master, crem, crem2, crem3, 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, prob, release/1.4.4, sabiod, search, security, server, social, storage, telecaster, test
Children:
30741ae
Parents:
86f7310 (diff), fabced9 (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@…> (21/03/2012 14:44:33)
git-committer:
yomguy <yomguy@…> (21/03/2012 14:44:33)
Message:

Merge branch 'master' into dev

Files:
15 added
10 edited

Legend:

Unmodified
Added
Removed
  • setup.py

    r49a9b01 ra62ff5a  
    2020        'timeside', 
    2121        'south', 
     22        'django-pagination', 
     23        'django-postman', 
     24        'django-socialregistration', 
    2225  ], 
    2326  platforms=['OS Independent'], 
  • telemeta/admin.py

    r7ed402e rfabced9  
    66from telemeta.models.system import * 
    77from django.contrib import admin 
    8 from django.forms import CheckboxSelectMultiple 
    98 
    109class MediaFondsAdmin(admin.ModelAdmin): 
    1110    search_fields = ['title', 'code'] 
    1211    ordering = ['code'] 
     12    filter_horizontal = ['children'] 
    1313 
    1414class MediaCorpusAdmin(admin.ModelAdmin): 
    1515    search_fields = ['title', 'code'] 
    1616    ordering = ['code'] 
    17     formfield_overrides = { 
    18         models.ManyToManyField: {'widget': CheckboxSelectMultiple} 
    19         } 
    20  
     17    filter_horizontal = ['children'] 
     18     
    2119class MediaCollectionAdmin(admin.ModelAdmin): 
    2220    search_fields = ['title', 'code'] 
  • telemeta/htdocs/js/playlist.js

    r461ebfc r2329add  
    9393        return new String(d.getTime() + '' + Math.floor(Math.random() * 1000000)).substr(0, 18); 
    9494    }, 
     95 
    9596    add : function(dictionary){ 
    9697 
    9798        if(dictionary.public_id===undefined){ 
    98             dictionary.public_id = this.uniqid(); //defined in application.js 
     99            dictionary.public_id = this.uniqid(); 
    99100        } 
    100101        if(dictionary.user===undefined){ 
     
    106107        }); 
    107108    }, 
    108      
     109 
    109110    remove: function(id){ 
    110111        json([id],'telemeta.del_playlist',function(){ 
     
    131132        var dd = {}; 
    132133        var playlist = this; 
    133          
     134 
    134135        var playlists = this.playlists; 
    135136        for (var i=0; i< playlists.length; i++){ 
     
    139140            } 
    140141        } 
    141          
     142 
    142143        new PopupDiv({ 
    143144            'content':dd, 
     
    157158        }).show(); 
    158159    }, 
    159      
     160 
    160161    /*shows the popup for adding a resource to a playlist*/ 
    161162    showAddResourceToPlaylist: function(anchorElement, resourceType, objectId, optionalOkMessage){ 
     
    166167        } 
    167168        var pl = this; 
    168          
     169 
    169170        if(!ar.length){ 
    170171            pl.showAdd(anchorElement); 
    171172        } 
    172          
     173 
    173174        //var addFcn = this.addResourceToPlaylist; 
    174175        new PopupDiv({ 
     
    178179                var val = data.selIndex; 
    179180                var callbackok = undefined; 
    180                      
     181 
    181182                if(optionalOkMessage){ 
    182183                    callbackok = function(){ 
  • telemeta/models/media.py

    rc9f9871 rbf87cda  
    8888 
    8989class MediaBaseResource(MediaResource): 
    90     "Describe a base resource" 
     90    "Describe a media base resource" 
    9191 
    9292    title                 = CharField(_('title'), required=True) 
  • telemeta/templates/telemeta/base.html

    rcc86e27 rfabced9  
    2020<![endif]--> 
    2121{% endblock %} 
     22 
     23{% block extra_stylesheets %}{% endblock %} 
    2224 
    2325{% block javascript %} 
     
    9294  <li><a href="{% url telemeta-home %}" class="blue">{% trans "Home" %}</a></li> 
    9395 {% endif %} 
     96 
     97 {% block archives %} 
    9498 <li><a href="#archives#" class="green">{% trans "Archives" %}</a> 
    9599  <ul> 
     
    101105  <div class="clear"></div> 
    102106 </li> 
     107 {% endblock archives %} 
     108  
     109 {% block geonav %} 
    103110 <li><a href="{% url telemeta-geo-continents %}" class="yellow">{% trans "Geo Navigator" %}</a></li> 
     111 {% endblock geonav %} 
     112 
    104113 <li><a href="{% url telemeta-search-criteria %}" class="orange">{% trans "Advanced search" %}</a></li> 
    105114 {% if user.is_authenticated %} 
     
    124133{% endblock header %} 
    125134 
     135{% block postman_menu %} 
     136{% endblock postman_menu %} 
     137 
    126138<div id="content"> 
    127139    <table id="content_header"><tr> 
     
    133145{% block delete %}{% endblock %} 
    134146</div> 
     147 
     148{% block body %} 
     149{% endblock body %} 
    135150 
    136151{% block footer %} 
  • telemeta/templatetags/telemeta_utils.py

    r396801e r0073410  
    398398        return 'Audio' 
    399399 
     400@register.filter 
     401def installed(app): 
     402    return app in settings.INSTALLED_APPS 
  • 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.