From: yomguy Date: Wed, 4 May 2011 15:13:09 +0000 (+0200) Subject: add empty some fields to detail templates, fix collections qs X-Git-Tag: 1.1~247 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=f0c3fecc559aa3067ef62379acfad2aab9e06486;p=telemeta.git add empty some fields to detail templates, fix collections qs --- diff --git a/telemeta/models/__init__.py b/telemeta/models/__init__.py index 72aa524c..9bec6cce 100644 --- a/telemeta/models/__init__.py +++ b/telemeta/models/__init__.py @@ -37,5 +37,6 @@ from telemeta.models.location import * from telemeta.models.instrument import * from telemeta.models.enum import * from telemeta.models.system import * +from telemeta.models.query import * diff --git a/telemeta/models/query.py b/telemeta/models/query.py index 624bbcda..0324abff 100644 --- a/telemeta/models/query.py +++ b/telemeta/models/query.py @@ -190,7 +190,8 @@ class MediaItemQuerySet(CoreQuerySet): def by_fuzzy_collector(self, pattern): return self.filter(self.by_fuzzy_collector_q(pattern)) - + + class MediaItemManager(CoreManager): "Manage media items queries" @@ -230,6 +231,7 @@ class MediaItemManager(CoreManager): return self.get_query_set().by_location(*args, **kwargs) by_location.__doc__ = MediaItemQuerySet.by_location.__doc__ + class MediaCollectionQuerySet(CoreQuerySet): def quick_search(self, pattern): @@ -312,6 +314,7 @@ class MediaCollectionQuerySet(CoreQuerySet): def by_fuzzy_collector(self, pattern): return self.filter(self.by_fuzzy_collector_q(pattern)) + class MediaCollectionManager(CoreManager): "Manage collection queries" @@ -346,7 +349,7 @@ class MediaCollectionManager(CoreManager): def by_change_time(self, *args, **kwargs): return self.get_query_set().by_change_time(*args, **kwargs) by_change_time.__doc__ = MediaCollectionQuerySet.by_change_time.__doc__ - + @staticmethod def __name_cmp(obj1, obj2): return unaccent_icmp(obj1.name, obj2.name) diff --git a/telemeta/templates/telemeta_default/collection_detail.html b/telemeta/templates/telemeta_default/collection_detail.html index 57511ae0..745db2a1 100644 --- a/telemeta/templates/telemeta_default/collection_detail.html +++ b/telemeta/templates/telemeta_default/collection_detail.html @@ -84,13 +84,11 @@ {% dl_field collection "reference" %} {% dl_field collection "title" %} {% dl_field collection "alt_title" %} - {% dl_field collection "creator" %} + {% dl_field collection "creator" placeholder %} {% dl_field collection "recording_context" %} - {% if collection.recorded_from_year %} -
{% trans "Recording year" %}
-
{{ collection.recorded_from_year|default:'' }} {{ collection.recorded_to_year|prepend:" - " }}
- {% endif %} - {% dl_field collection "year_published" %} +
{% trans "Recording year" %}
+
{% if collection.recorded_from_year %}{{ collection.recorded_from_year|default:'' }} {{ collection.recorded_to_year|prepend:" - " }}{% endif %}
+ {% dl_field collection "year_published" placeholder %} {% endblock general_info %} @@ -101,7 +99,7 @@
{% dl_field collection "countries" join with ", " %} - {% dl_field collection "ethnic_groups" join with ", " %} + {% dl_field collection "ethnic_groups" join with ", " placeholder %}
diff --git a/telemeta/templates/telemeta_default/collection_list.html b/telemeta/templates/telemeta_default/collection_list.html index 3d3005fe..f570a2d8 100644 --- a/telemeta/templates/telemeta_default/collection_list.html +++ b/telemeta/templates/telemeta_default/collection_list.html @@ -8,7 +8,7 @@

{% trans "Media Collections" %}

{% endblock %} {% block title_buttons %} - {% trans "All" %} + {% trans "All" %} {% trans "Unpublished" %} {% trans "Published" %} {% if user.is_authenticated and perms.telemeta.add_mediacollection %} diff --git a/telemeta/templates/telemeta_default/mediaitem_detail.html b/telemeta/templates/telemeta_default/mediaitem_detail.html index 8621a39a..93e3ec37 100644 --- a/telemeta/templates/telemeta_default/mediaitem_detail.html +++ b/telemeta/templates/telemeta_default/mediaitem_detail.html @@ -212,15 +212,15 @@
{% block general_info %}
- {% dl_field item "title" %} + {% dl_field item "title" placeholder %} {% dl_field item "alt_title" %} - {% dl_field item "collector" %} + {% dl_field item "collector" placeholder %}
{% field_label item "collection" %}
{{ item.collection }}
- {% if item.recorded_from_date %}
{% trans "Recording date" %}
-
{{ item.recorded_from_date }} {{ item.recorded_to_date|prepend:" - " }}
- {% endif %} + +
{% if item.recorded_from_date %}{{ item.recorded_from_date }} {{ item.recorded_to_date|prepend:" - " }}{% endif %}
+
{% endblock general_info %}
@@ -229,13 +229,11 @@

{% trans "Geographic and cultural informations" %}

- {% if item.location %}
{% trans "Location" %}
-
{{ item.location.fullnames|join:"
" }}
- {% endif %} +
{% if item.location %}{{ item.location.fullnames|join:"
" }}{% endif %}
{% dl_field item "location_comment" %} {% dl_field item "cultural_area" %} - {% dl_field item "ethnic_group" %} + {% dl_field item "ethnic_group" placeholder %} {% dl_field item "context_comment" %} {% dl_field item "keywords" join with ", " %}
diff --git a/telemeta/urls.py b/telemeta/urls.py index 128df0d8..3eba1216 100644 --- a/telemeta/urls.py +++ b/telemeta/urls.py @@ -51,9 +51,10 @@ all_items = { 'queryset': MediaItem.objects.enriched(), } all_collections = { 'queryset': MediaCollection.objects.enriched(), } # CREM collections -all_collections_novel = { 'queryset': MediaCollection.objects.filter(code__contains='_I_'), } +all_collections_unpublished = { 'queryset': MediaCollection.objects.filter(code__contains='_I_'), } all_collections_published = { 'queryset': MediaCollection.objects.filter(code__contains='_E_'), } + # ID's regular expressions export_extensions = "|".join(web_view.list_export_extensions()) @@ -104,7 +105,7 @@ urlpatterns = patterns('', url(r'^collections/$', 'django.views.generic.list_detail.object_list', dict(all_collections, paginate_by=20, template_name="telemeta/collection_list.html"), name="telemeta-collections"), url(r'^collections_unpublished/$', 'django.views.generic.list_detail.object_list', - dict(all_collections_novel, paginate_by=20, template_name="telemeta/collection_list.html"), name="telemeta-collections-unpublished"), + dict(all_collections_unpublished, paginate_by=20, template_name="telemeta/collection_list.html"), name="telemeta-collections-unpublished"), url(r'^collections_published/$', 'django.views.generic.list_detail.object_list', dict(all_collections_published, paginate_by=20, template_name="telemeta/collection_list.html"), name="telemeta-collections-published"), url(r'^collections/?page=(?P[0-9]+)$',