--- a/.settings/org.eclipse.core.resources.prefs Wed Jun 26 10:58:47 2013 +0200
+++ b/.settings/org.eclipse.core.resources.prefs Wed Jun 26 16:25:10 2013 +0200
@@ -20,6 +20,7 @@
encoding//src/jocondelab/management/commands/import_skos.py=utf-8
encoding//src/jocondelab/management/commands/import_term_labels.py=utf-8
encoding//src/jocondelab/management/commands/import_terms.py=utf-8
+encoding//src/jocondelab/migrations/0001_initial.py=utf-8
encoding//src/jocondelab/models.py=utf-8
encoding//src/jocondelab/utils.py=utf-8
encoding//src/jocondelab/views.py=utf-8
--- a/src/core/models/__init__.py Wed Jun 26 10:58:47 2013 +0200
+++ b/src/core/models/__init__.py Wed Jun 26 16:25:10 2013 +0200
@@ -1,11 +1,11 @@
__all__ = ['Notice', 'Term', 'TermLabel', 'Thesaurus', 'NoticeImage', 'NoticeTerm',
'AutrNoticeTerm', 'DomnNoticeTerm', 'EcolNoticeTerm',
'EpoqNoticeTerm', 'LieuxNoticeTerm', 'PeriNoticeTerm',
- 'ReprNoticeTerm',
+ 'ReprNoticeTerm', 'SrepNoticeTerm',
'TERM_URL_STATUS_CHOICES', 'TERM_URL_STATUS_CHOICES_TRANS', 'TERM_URL_STATUS_DICT']
from .notice import (Notice, NoticeImage, NoticeTerm, AutrNoticeTerm,
DomnNoticeTerm, EcolNoticeTerm, EpoqNoticeTerm, LieuxNoticeTerm, PeriNoticeTerm,
- ReprNoticeTerm)
+ ReprNoticeTerm, SrepNoticeTerm)
from .term import (Term, TermLabel, Thesaurus, TERM_URL_STATUS_CHOICES,
TERM_URL_STATUS_CHOICES_TRANS, TERM_URL_STATUS_DICT)
--- a/src/jocondelab/forms.py Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/forms.py Wed Jun 26 16:25:10 2013 +0200
@@ -35,11 +35,11 @@
return bool(int(val))
class TermFilterForm(Form):
- thesaurus = ModelChoiceField(label=_("thesaurus"), required=False, queryset=Thesaurus.objects.all())
+ thesaurus = ModelChoiceField(label=_("thesaurus"), required=False, queryset=Thesaurus.objects.all().order_by('label'))
label = fields.CharField(label=_("label"), required=False)
link_status = fields.TypedChoiceField(label=_("link_status"), required=False, empty_value=-1, coerce=int, choices=tuple([(-1,'---------')]+[(v, l) for v,l in TERM_URL_STATUS_CHOICES_TRANS]))
validated = fields.TypedChoiceField(label=_("validated"), required=False, empty_value=None, coerce=validated_to_bool, choices=(("", "---"),("1", _("yes")), ("0", _("no"))))
- order_by = fields.ChoiceField(label=_("order_by"), required=False, choices=(('normalized_label',_('label')),('uri',_('uri'))))
+ order_by = fields.ChoiceField(label=_("order_by"), required=False, choices=(('normalized_label',_('label')),('nb_notice',_('nb notice'))))
order_dir = fields.ChoiceField(label=_("order_dir"), required=False, choices=(('asc',_('asc')), ('desc',_('desc'))))
def get_filter_qs(self, base_qs=None):
Binary file src/jocondelab/locale/en/LC_MESSAGES/django.mo has changed
--- a/src/jocondelab/locale/en/LC_MESSAGES/django.po Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/locale/en/LC_MESSAGES/django.po Wed Jun 26 16:25:10 2013 +0200
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-06-25 14:08+0200\n"
+"POT-Creation-Date: 2013-06-26 16:18+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -20,7 +20,7 @@
msgid "language"
msgstr "language"
-#: forms.py:38
+#: forms.py:38 templates/jocondelab/term_list.html:11
msgid "thesaurus"
msgstr "thesaurus"
@@ -48,9 +48,9 @@
msgid "order_by"
msgstr "order by"
-#: forms.py:42 templates/jocondelab/term_edit.html:90
-msgid "uri"
-msgstr "uri"
+#: forms.py:42 templates/jocondelab/term_list.html:11
+msgid "nb notice"
+msgstr "nb of notice"
#: forms.py:43
msgid "order_dir"
@@ -76,6 +76,10 @@
msgid "id"
msgstr "id"
+#: templates/jocondelab/term_edit.html:90
+msgid "uri"
+msgstr "uri"
+
#: templates/jocondelab/term_edit.html:94
msgid "info wikipedia"
msgstr "Wikipedia info"
@@ -96,6 +100,22 @@
msgid "Edition wk"
msgstr "WK Edition"
+#: templates/jocondelab/term_list.html:11
+msgid "Label"
+msgstr "Label"
+
+#: templates/jocondelab/term_list.html:11
+msgid "wikipedia"
+msgstr "Wikipedia info"
+
+#: templates/jocondelab/term_list.html:11
+msgid "dbpedia"
+msgstr "dbpedia"
+
+#: templates/jocondelab/term_list.html:11
+msgid "valid."
+msgstr "valid."
+
#: templates/jocondelab/partial/filter.html:8
msgid "Search"
msgstr "Search"
Binary file src/jocondelab/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/jocondelab/locale/fr/LC_MESSAGES/django.po Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/locale/fr/LC_MESSAGES/django.po Wed Jun 26 16:25:10 2013 +0200
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-06-25 14:08+0200\n"
+"POT-Creation-Date: 2013-06-26 16:18+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -21,7 +21,7 @@
msgid "language"
msgstr "langue"
-#: forms.py:38
+#: forms.py:38 templates/jocondelab/term_list.html:11
msgid "thesaurus"
msgstr "thésaurus"
@@ -49,9 +49,9 @@
msgid "order_by"
msgstr "ord. par"
-#: forms.py:42 templates/jocondelab/term_edit.html:90
-msgid "uri"
-msgstr "uri"
+#: forms.py:42 templates/jocondelab/term_list.html:11
+msgid "nb notice"
+msgstr "nb notice"
#: forms.py:43
msgid "order_dir"
@@ -77,6 +77,10 @@
msgid "id"
msgstr "id"
+#: templates/jocondelab/term_edit.html:90
+msgid "uri"
+msgstr "uri"
+
#: templates/jocondelab/term_edit.html:94
msgid "info wikipedia"
msgstr "info wikipedia"
@@ -97,6 +101,23 @@
msgid "Edition wk"
msgstr "Edition wk"
+#: templates/jocondelab/term_list.html:11
+msgid "Label"
+msgstr "label"
+
+#: templates/jocondelab/term_list.html:11
+#, fuzzy
+msgid "wikipedia"
+msgstr "info wikipedia"
+
+#: templates/jocondelab/term_list.html:11
+msgid "dbpedia"
+msgstr "dbpedia"
+
+#: templates/jocondelab/term_list.html:11
+msgid "valid."
+msgstr "validé"
+
#: templates/jocondelab/partial/filter.html:8
msgid "Search"
msgstr "Rech."
--- a/src/jocondelab/management/commands/import_csv.py Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/management/commands/import_csv.py Wed Jun 26 16:25:10 2013 +0200
@@ -204,7 +204,7 @@
self.stdout.write("Processing %d notices" % notice_count)
writer = None
- for i,notice_obj in enumerate(Notice.objects.all().iterator()):
+ for i,notice_obj in enumerate(Notice.objects.all().order_by('ref').iterator()):
writer = show_progress(i+1, notice_count, u"Processing notice %s" % notice_obj.ref, 50, writer)
for field in POST_NOTICE_FIELDS:
processor = NOTICE_FIELD_PROCESSORS.get(field, DEFAULT_FIELD_PROCESSOR_KLASS(field))
--- a/src/jocondelab/migrations/0001_initial.py Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/migrations/0001_initial.py Wed Jun 26 16:25:10 2013 +0200
@@ -9,7 +9,7 @@
def forwards(self, orm):
# Adding model 'User'
- db.create_table(u'jocondelab_user', (
+ db.create_table(u'jocondelab_user', ( # @UndefinedVariable
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('password', self.gf('django.db.models.fields.CharField')(max_length=128)),
('last_login', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
@@ -23,34 +23,34 @@
('date_joined', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
('language', self.gf('django.db.models.fields.CharField')(default='en', max_length=2)),
))
- db.send_create_signal(u'jocondelab', ['User'])
+ db.send_create_signal(u'jocondelab', ['User']) # @UndefinedVariable
# Adding M2M table for field groups on 'User'
- db.create_table(u'jocondelab_user_groups', (
+ db.create_table(u'jocondelab_user_groups', ( # @UndefinedVariable
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('user', models.ForeignKey(orm[u'jocondelab.user'], null=False)),
('group', models.ForeignKey(orm[u'auth.group'], null=False))
))
- db.create_unique(u'jocondelab_user_groups', ['user_id', 'group_id'])
+ db.create_unique(u'jocondelab_user_groups', ['user_id', 'group_id']) # @UndefinedVariable
# Adding M2M table for field user_permissions on 'User'
- db.create_table(u'jocondelab_user_user_permissions', (
+ db.create_table(u'jocondelab_user_user_permissions', ( # @UndefinedVariable
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('user', models.ForeignKey(orm[u'jocondelab.user'], null=False)),
('permission', models.ForeignKey(orm[u'auth.permission'], null=False))
))
- db.create_unique(u'jocondelab_user_user_permissions', ['user_id', 'permission_id'])
+ db.create_unique(u'jocondelab_user_user_permissions', ['user_id', 'permission_id']) # @UndefinedVariable
def backwards(self, orm):
# Deleting model 'User'
- db.delete_table(u'jocondelab_user')
+ db.delete_table(u'jocondelab_user') # @UndefinedVariable
# Removing M2M table for field groups on 'User'
- db.delete_table('jocondelab_user_groups')
+ db.delete_table('jocondelab_user_groups') # @UndefinedVariable
# Removing M2M table for field user_permissions on 'User'
- db.delete_table('jocondelab_user_user_permissions')
+ db.delete_table('jocondelab_user_user_permissions') # @UndefinedVariable
models = {
--- a/src/jocondelab/static/jocondelab/css/style.css Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/style.css Wed Jun 26 16:25:10 2013 +0200
@@ -355,6 +355,14 @@
.text_centered {
text-align: center;
}
+.text_left_aligned {
+ text-align: left;
+}
+.text_right_aligned {
+ text-align: right;
+}
+
+
.hand_cursor, .reset_wp_info, .remove_wp_link, .remove_tag_from_list {
cursor: pointer;
}
@@ -430,6 +438,10 @@
padding: 2px;
}
+#term-list-table th {
+ text-align: center;
+}
+
.term-list-label {
width : 500px;
}
--- a/src/jocondelab/templates/jocondelab/partial/term_list_table.html Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/partial/term_list_table.html Wed Jun 26 16:25:10 2013 +0200
@@ -3,7 +3,7 @@
<div id="term-list-table-div">
<table id="term-list-table">
<thead>
- <tr><th>Label</th><th>thes</th><th>wk</th><th>dbp</th><th>valid.</th></tr>
+ <tr><th>Label</th><th>thes</th><th>wk</th><th>dbp</th><th>valid.</th><th>nb</th></tr>
</thead>
<tbody>
{% for term in object_list %}
@@ -31,6 +31,9 @@
<input type="checkbox" readonly="readonly" disabled="disabled"/>
{% endif %}
</td>
+ <td class="text_right_aligned">
+ {{ term.nb_notice }}
+ </td>
</tr>
{% endfor %}
</tbody>
--- a/src/jocondelab/templates/jocondelab/term_list.html Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/term_list.html Wed Jun 26 16:25:10 2013 +0200
@@ -1,5 +1,6 @@
{% extends "jocondelab/base.html" %}
{% load core_extras %}
+{% load i18n %}
{% block content %}
<div id="term-filter-top-container">{% include "jocondelab/partial/filter.html" %}</div>
@@ -7,7 +8,7 @@
<div id="term-list-table">
<table >
<thead>
- <tr><th>Label</th><th>thesaurus</th><th>wikipedia</th><th>dbpedia</th><th>valid.</th></tr>
+ <tr><th>{% trans 'Label' %}</th><th>{% trans 'thesaurus' %}</th><th>{% trans 'wikipedia' %}</th><th>{% trans 'dbpedia' %}</th><th>{% trans 'valid.' %}</th><th>{% trans 'nb notice' %}</th></tr>
</thead>
<tbody>
{% for term in object_list %}
@@ -35,7 +36,9 @@
<input type="checkbox" readonly="readonly" disabled="disabled"/>
{% endif %}
</td>
-
+ <td class="text_right_aligned">
+ {{ term.nb_notice }}
+ </td>
</tr>
{% endfor %}
</tbody>
--- a/src/jocondelab/utils.py Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/utils.py Wed Jun 26 16:25:10 2013 +0200
@@ -5,6 +5,7 @@
@author: ymh
'''
+from core.models import Term
from django.conf import settings
from django.core.paginator import Paginator, Page, PageNotAnInteger, EmptyPage
import logging
@@ -42,6 +43,11 @@
visible_range = getattr(settings, 'PAGINATOR_VISIBLE_RANGE', 5)
start_range = getattr(settings, 'PAGINATOR_START_RANGE', visible_range/2)
+ def __init__(self, object_list, number, paginator):
+ self.number = number
+ self.paginator = paginator
+ self.orginal_object_list = object_list
+
def __get_start_range(self):
return max(1,self.number-self.visible_range/2)
@@ -62,4 +68,20 @@
res.append(i)
prev = i
return res
-
\ No newline at end of file
+
+ def object_list(): #@NoSelf
+ doc = """Get proxy object list""" #@UnusedVariable
+
+ def fget(self):
+ term_dict = dict([(t.id,t) for t in Term.objects.filter(id__in=[d['id'] for d in self.orginal_object_list]).select_related()])
+
+ def map_object(t):
+ mapped_obj = term_dict[t['id']]
+ mapped_obj.nb_notice = t['nb_notice']
+ return mapped_obj
+
+ return map(map_object, self.orginal_object_list)
+
+ return locals()
+
+ object_list = property(**object_list())
\ No newline at end of file
--- a/src/jocondelab/views.py Wed Jun 26 10:58:47 2013 +0200
+++ b/src/jocondelab/views.py Wed Jun 26 16:25:10 2013 +0200
@@ -13,6 +13,7 @@
TERM_WK_LINK_SEMANTIC_LEVEL_CHOICES)
from core.wp_utils import process_term as wp_process_term
from django.conf import settings
+from django.db.models import Count
from django.http.response import HttpResponse
from django.views.generic import ListView, DetailView, View
from jocondelab.forms import WikipediaEditionForm, LinkSemanticLevelForm
@@ -44,7 +45,7 @@
return context
def get_queryset(self):
- qs = ListView.get_queryset(self)
+ qs = Term.objects.values('id').annotate(nb_notice=Count("noticeterm"))
filter_form = self.get_filter_form()
if filter_form.is_valid():
return filter_form.get_filter_qs(qs)
@@ -95,7 +96,6 @@
'SREP' : u"Source sujet représenté"
}.get(self.object.thesaurus.label, self.object.thesaurus.label)
- #Source%20sujet%20repr%e9sent%e9
encoded_label = self.object.label.encode('latin1') if self.object.label is not None else ""
context['encoded_term_label_query_parameter'] = urllib. urlencode({