# HG changeset patch
# User cavaliet
# Date 1379061363 -7200
# Node ID c1e36f5911a9e078ebbc4e0badd03dc9ec7b2a69
# Parent d585f6b46b88ace845d5b5ed269b30edcd91ccdc# Parent 1d45a564a39851504ccc27bb6944db7e85430fbc
Merge with 1d45a564a39851504ccc27bb6944db7e85430fbc
diff -r d585f6b46b88 -r c1e36f5911a9 src/p4l/models/data.py
--- a/src/p4l/models/data.py Fri Sep 13 10:31:33 2013 +0200
+++ b/src/p4l/models/data.py Fri Sep 13 10:36:03 2013 +0200
@@ -171,6 +171,9 @@
isDocumentPart = models.BooleanField() #iiep:isDocumentPart
isMultilingual = models.BooleanField() #iiep:isMultilingual
+
+ def get_imprints_years(self):
+ return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))
def __unicode__(self):
return "Record id %s { identifier: %s, uri: %s, editionStatement: %s, recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \
diff -r d585f6b46b88 -r c1e36f5911a9 src/p4l/settings.py
--- a/src/p4l/settings.py Fri Sep 13 10:31:33 2013 +0200
+++ b/src/p4l/settings.py Fri Sep 13 10:36:03 2013 +0200
@@ -141,6 +141,7 @@
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'django.core.context_processors.i18n',
+ 'django.core.context_processors.request',
)
# A sample logging configuration. The only tangible logging
diff -r d585f6b46b88 -r c1e36f5911a9 src/p4l/static/p4l/js/p4l.js
--- a/src/p4l/static/p4l/js/p4l.js Fri Sep 13 10:31:33 2013 +0200
+++ b/src/p4l/static/p4l/js/p4l.js Fri Sep 13 10:36:03 2013 +0200
@@ -267,9 +267,15 @@
$scope.submitRecord = function() {
$scope.saving = true;
- $scope.record.$save({recordId: context.record_id}).then(function(response) { $scope.saving=false;});
+ $scope.record.$save({recordId: context.record_id})
+ .then(function(response) {
+ $scope.saving=false;
+ });
}
+ $scope.getPreviousUrl = function() {
+ return context.urls.previous || context.urls.home;
+ }
});
diff -r d585f6b46b88 -r c1e36f5911a9 src/p4l/templates/p4l/p4l_home.html
--- a/src/p4l/templates/p4l/p4l_home.html Fri Sep 13 10:31:33 2013 +0200
+++ b/src/p4l/templates/p4l/p4l_home.html Fri Sep 13 10:36:03 2013 +0200
@@ -36,7 +36,7 @@
{% endif %}
- | {% trans 'identifier' %} | {% trans 'titles' %} | {% trans 'dates' %} (années imprint) | {% trans 'actions' %} |
+ | {% trans 'identifier' %} | {% trans 'titles' %} | {% trans 'dates' %} | {% trans 'actions' %} |
{% for record in object_list %}
@@ -45,10 +45,10 @@
{% for t in record.titles.all %}
- {{ t.title }}
{% endfor %} |
- |
+ {{ record.get_imprints_years|join:", "}} |
-
+
|
{% empty %}
diff -r d585f6b46b88 -r c1e36f5911a9 src/p4l/templates/p4l/record_update_form.html
--- a/src/p4l/templates/p4l/record_update_form.html Fri Sep 13 10:31:33 2013 +0200
+++ b/src/p4l/templates/p4l/record_update_form.html Fri Sep 13 10:36:03 2013 +0200
@@ -28,7 +28,9 @@
csrf_token: "{{ csrf_token }}",
urls: {
base_static: "{% get_static_prefix %}",
- record_api: "{% url 'record-detail' identifier=':recordId' %}".replace("\%3A",":"),
+ record_api: "{% url 'record-detail' identifier=':recordId' %}".replace("\%3A",":"),
+ previous: "{{request.GET.previous}}",
+ home: "{% url 'p4l_home' %}"
},
query_dicts: angular.fromJson('{{ query_dicts | safe | addslashes}}'),
languages_list: angular.fromJson('{{ languages_list | safe | addslashes}}'),
@@ -43,6 +45,7 @@
{% block content %}
{% verbatim %}
{% endverbatim %}
{% endblock %}
\ No newline at end of file
diff -r d585f6b46b88 -r c1e36f5911a9 src/p4l/views.py
--- a/src/p4l/views.py Fri Sep 13 10:31:33 2013 +0200
+++ b/src/p4l/views.py Fri Sep 13 10:36:03 2013 +0200
@@ -6,7 +6,6 @@
'''
from django.conf import settings
-from django.utils.decorators import method_decorator
from django.views.generic import ListView, DetailView
from p4l.forms import RecordFilterForm
from p4l.models import Record
@@ -19,7 +18,7 @@
class RecordListView(ListView):
- queryset = Record.objects.select_related("language").prefetch_related('titles').distinct() # @UndefinedVariable
+ queryset = Record.objects.select_related("language").prefetch_related('titles', 'imprints').order_by('identifier') # @UndefinedVariable
paginate_by = settings.NB_RECORDS_BY_PAGE
template_name = "p4l/p4l_home.html"
form_class = RecordFilterForm
@@ -182,7 +181,7 @@
# Languages list used in drop down list
context['languages_list'] = json.dumps(settings.LANGUAGES_LIST)
-
+
return context
\ No newline at end of file