# HG changeset patch # User cavaliet # Date 1379341110 -7200 # Node ID c675183a93251d18ca79cedd15ca031b836ea8f2 # Parent 57633a3acc4f58a5a21ba0b33de76bca1bfc3074 new record diff -r 57633a3acc4f -r c675183a9325 src/p4l/api/serializers.py --- a/src/p4l/api/serializers.py Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/api/serializers.py Mon Sep 16 16:18:30 2013 +0200 @@ -117,7 +117,7 @@ ''' Serializer for record ''' - language = ThesaurusSerializer(many=False, slug_field='uri') + language = ThesaurusSerializer(many=False, required=False, slug_field='uri') otherLanguages = ThesaurusSerializer(many=True, slug_field='uri') subjects = ThesaurusSerializer(many=True, slug_field='uri') themes = ThesaurusSerializer(many=True, slug_field='uri') diff -r 57633a3acc4f -r c675183a9325 src/p4l/locale/en/LC_MESSAGES/django.po --- a/src/p4l/locale/en/LC_MESSAGES/django.po Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/locale/en/LC_MESSAGES/django.po Mon Sep 16 16:18:30 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-16 08:07-0500\n" +"POT-Creation-Date: 2013-09-16 09:15-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -65,8 +65,8 @@ msgid "Record List" msgstr "Record list" -#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:29 -#: templates/p4l/p4l_home.html:66 +#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:30 +#: templates/p4l/p4l_home.html:67 msgid "Page" msgstr "Page" @@ -74,36 +74,41 @@ msgid "Title" msgstr "Title" -#: templates/p4l/p4l_home.html:26 templates/p4l/p4l_home.html.py:63 +#: templates/p4l/p4l_home.html:19 +#, fuzzy +msgid "New record" +msgstr "No record" + +#: templates/p4l/p4l_home.html:27 templates/p4l/p4l_home.html.py:64 msgid "Previous" msgstr "Previous" -#: templates/p4l/p4l_home.html:29 templates/p4l/p4l_home.html.py:66 +#: templates/p4l/p4l_home.html:30 templates/p4l/p4l_home.html.py:67 msgid "on" msgstr "on" -#: templates/p4l/p4l_home.html:32 templates/p4l/p4l_home.html.py:69 +#: templates/p4l/p4l_home.html:33 templates/p4l/p4l_home.html.py:70 msgid "Next" msgstr "Next" -#: templates/p4l/p4l_home.html:39 templates/p4l/p4l_record_view.html:35 +#: templates/p4l/p4l_home.html:40 templates/p4l/p4l_record_view.html:35 msgid "identifier" msgstr "identifier" -#: templates/p4l/p4l_home.html:39 templates/p4l/p4l_record_view.html:63 +#: templates/p4l/p4l_home.html:40 templates/p4l/p4l_record_view.html:63 msgid "titles" msgstr "titles" -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 #, fuzzy msgid "dates" msgstr "Update" -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 msgid "actions" msgstr "actions" -#: templates/p4l/p4l_home.html:55 +#: templates/p4l/p4l_home.html:56 msgid "No record" msgstr "No record" diff -r 57633a3acc4f -r c675183a9325 src/p4l/locale/es/LC_MESSAGES/django.po --- a/src/p4l/locale/es/LC_MESSAGES/django.po Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/locale/es/LC_MESSAGES/django.po Mon Sep 16 16:18:30 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-16 08:07-0500\n" +"POT-Creation-Date: 2013-09-16 09:15-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -66,8 +66,8 @@ msgid "Record List" msgstr "Record list" -#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:29 -#: templates/p4l/p4l_home.html:66 +#: templates/p4l/p4l_home.html:6 templates/p4l/p4l_home.html.py:30 +#: templates/p4l/p4l_home.html:67 msgid "Page" msgstr "Page" @@ -75,36 +75,41 @@ msgid "Title" msgstr "Title" -#: templates/p4l/p4l_home.html:26 templates/p4l/p4l_home.html.py:63 +#: templates/p4l/p4l_home.html:19 +#, fuzzy +msgid "New record" +msgstr "No record" + +#: templates/p4l/p4l_home.html:27 templates/p4l/p4l_home.html.py:64 msgid "Previous" msgstr "Previous" -#: templates/p4l/p4l_home.html:29 templates/p4l/p4l_home.html.py:66 +#: templates/p4l/p4l_home.html:30 templates/p4l/p4l_home.html.py:67 msgid "on" msgstr "on" -#: templates/p4l/p4l_home.html:32 templates/p4l/p4l_home.html.py:69 +#: templates/p4l/p4l_home.html:33 templates/p4l/p4l_home.html.py:70 msgid "Next" msgstr "Next" -#: templates/p4l/p4l_home.html:39 templates/p4l/p4l_record_view.html:35 +#: templates/p4l/p4l_home.html:40 templates/p4l/p4l_record_view.html:35 msgid "identifier" msgstr "identifier" -#: templates/p4l/p4l_home.html:39 templates/p4l/p4l_record_view.html:63 +#: templates/p4l/p4l_home.html:40 templates/p4l/p4l_record_view.html:63 msgid "titles" msgstr "titles" -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 #, fuzzy msgid "dates" msgstr "Update" -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 msgid "actions" msgstr "actions" -#: templates/p4l/p4l_home.html:55 +#: templates/p4l/p4l_home.html:56 msgid "No record" msgstr "No record" diff -r 57633a3acc4f -r c675183a9325 src/p4l/locale/fr/LC_MESSAGES/django.mo Binary file src/p4l/locale/fr/LC_MESSAGES/django.mo has changed diff -r 57633a3acc4f -r c675183a9325 src/p4l/locale/fr/LC_MESSAGES/django.po --- a/src/p4l/locale/fr/LC_MESSAGES/django.po Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/locale/fr/LC_MESSAGES/django.po Mon Sep 16 16:18:30 2013 +0200 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-16 08:07-0500\n" +"POT-Creation-Date: 2013-09-16 09:15-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -74,8 +74,8 @@ msgstr "Liste notice" #: templates/p4l/p4l_home.html:6 -#: templates/p4l/p4l_home.html.py:29 -#: templates/p4l/p4l_home.html:66 +#: templates/p4l/p4l_home.html.py:30 +#: templates/p4l/p4l_home.html:67 msgid "Page" msgstr "Page" @@ -83,40 +83,44 @@ msgid "Title" msgstr "Titre" -#: templates/p4l/p4l_home.html:26 -#: templates/p4l/p4l_home.html.py:63 +#: templates/p4l/p4l_home.html:19 +msgid "New record" +msgstr "Nouvelle notice" + +#: templates/p4l/p4l_home.html:27 +#: templates/p4l/p4l_home.html.py:64 msgid "Previous" msgstr "Préc." -#: templates/p4l/p4l_home.html:29 -#: templates/p4l/p4l_home.html.py:66 +#: templates/p4l/p4l_home.html:30 +#: templates/p4l/p4l_home.html.py:67 msgid "on" msgstr "sur" -#: templates/p4l/p4l_home.html:32 -#: templates/p4l/p4l_home.html.py:69 +#: templates/p4l/p4l_home.html:33 +#: templates/p4l/p4l_home.html.py:70 msgid "Next" msgstr "Suiv." -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 #: templates/p4l/p4l_record_view.html:35 msgid "identifier" msgstr "identifiant" -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 #: templates/p4l/p4l_record_view.html:63 msgid "titles" msgstr "titres" -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 msgid "dates" msgstr "dates" -#: templates/p4l/p4l_home.html:39 +#: templates/p4l/p4l_home.html:40 msgid "actions" msgstr "actions" -#: templates/p4l/p4l_home.html:55 +#: templates/p4l/p4l_home.html:56 msgid "No record" msgstr "Pas de notice" @@ -142,7 +146,8 @@ #: templates/p4l/record_update_form.html:224 msgid "" "Are your sure you want to delete this record ? This action est irreversible." -msgstr "Êtes-vous sûr sur vouloir effacer cette notice ? Cette action est irréversible." +msgstr "Êtes-vous sûr sur vouloir effacer cette notice ? Cette action est " +"irréversible." #: templates/p4l/p4l_record_view.html:11 #: templates/p4l/p4l_record_view.html:226 diff -r 57633a3acc4f -r c675183a9325 src/p4l/migrations/0001_initial.py --- a/src/p4l/migrations/0001_initial.py Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/migrations/0001_initial.py Mon Sep 16 16:18:30 2013 +0200 @@ -221,7 +221,7 @@ ('notes', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), ('language', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['p4l.Language'], null=True, blank=True)), ('editionStatement', self.gf('django.db.models.fields.CharField')(max_length=1024, null=True, blank=True)), - ('recordType', self.gf('django.db.models.fields.URLField')(max_length=2048)), + ('recordType', self.gf('django.db.models.fields.URLField')(max_length=2048, null=True, blank=True)), ('isDocumentPart', self.gf('django.db.models.fields.BooleanField')(default=False)), ('isMultilingual', self.gf('django.db.models.fields.BooleanField')(default=False)), )) @@ -550,7 +550,7 @@ 'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), 'otherLanguages': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'otherLanguage_record'", 'symmetrical': 'False', 'to': "orm['p4l.Language']"}), 'projectNames': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['p4l.ProjectName']", 'symmetrical': 'False'}), - 'recordType': ('django.db.models.fields.URLField', [], {'max_length': '2048'}), + 'recordType': ('django.db.models.fields.URLField', [], {'max_length': '2048', 'null': 'True', 'blank': 'True'}), 'subjectCorporateBodies': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'recordsSubjectCorporateBody'", 'symmetrical': 'False', 'to': "orm['p4l.CorporateAuthor']"}), 'subjects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['p4l.Subject']", 'symmetrical': 'False'}), 'themes': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['p4l.Theme']", 'symmetrical': 'False'}), diff -r 57633a3acc4f -r c675183a9325 src/p4l/models/data.py --- a/src/p4l/models/data.py Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/models/data.py Mon Sep 16 16:18:30 2013 +0200 @@ -167,7 +167,7 @@ #subjectMeetings = foreign key from 'p4l.SubjectMeeting' #iiep:subjectMeeting corporateAuthors = models.ManyToManyField('p4l.CorporateAuthor', related_name='recordsCorporateAuthor') #iiep:subjectCorporateBody # #urls foreign Key from Url #iiep:url - recordType = models.URLField(max_length=2048) #dct:type # + recordType = models.URLField(max_length=2048, blank=True, null=True) #dct:type # isDocumentPart = models.BooleanField() #iiep:isDocumentPart isMultilingual = models.BooleanField() #iiep:isMultilingual diff -r 57633a3acc4f -r c675183a9325 src/p4l/templates/p4l/p4l_home.html --- a/src/p4l/templates/p4l/p4l_home.html Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/templates/p4l/p4l_home.html Mon Sep 16 16:18:30 2013 +0200 @@ -7,8 +7,8 @@ {% block content %}
-

{% trans 'Record List' %}

-
+

{% trans 'Record List' %}

+
@@ -16,6 +16,7 @@
+ - {% trans 'New record' %}
diff -r 57633a3acc4f -r c675183a9325 src/p4l/urls.py --- a/src/p4l/urls.py Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/urls.py Mon Sep 16 16:18:30 2013 +0200 @@ -2,7 +2,8 @@ from django.contrib import admin from django.contrib.auth import urls as auth_urls from django.contrib.auth.decorators import login_required -from p4l.views import RecordListView, RecordDetailView, RecordEditView, RecordDeleteView +from p4l.views import RecordListView, RecordDetailView, RecordEditView, RecordDeleteView,\ + RecordNewView js_info_dict = { 'packages': ('p4l',), @@ -16,6 +17,7 @@ url(r'^auth/', include(auth_urls)), url(r'^record/view/(?P\w+)$', login_required(RecordDetailView.as_view()), name='p4l_record_view'), url(r'^record/edit/(?P\w+)$', login_required(RecordEditView.as_view()), name='p4l_record_edit'), + url(r'^record/new$', login_required(RecordNewView.as_view()), name='p4l_record_new'), url(r'^record/delete/(?P\w+)$', login_required(RecordDeleteView.as_view()), name='p4l_record_delete'), url(r'^api/', include('p4l.api.urls')), diff -r 57633a3acc4f -r c675183a9325 src/p4l/views.py --- a/src/p4l/views.py Mon Sep 16 15:11:18 2013 +0200 +++ b/src/p4l/views.py Mon Sep 16 16:18:30 2013 +0200 @@ -4,7 +4,7 @@ @author: tc ''' - +from datetime import datetime from django.conf import settings from django.views.generic import ListView, DetailView, View from django.shortcuts import redirect, get_object_or_404 @@ -186,6 +186,15 @@ return context +class RecordNewView(View): + def get(self, request, *args, **kwargs): + rec = Record() + rec.identifier = "T" + datetime.now().strftime("%Y%m%d%H%M%S") + rec.uri = "http://www.iiep.unesco.org/plan4learning/record/" + rec.identifier + rec.save() + return redirect('p4l_record_edit', rec.identifier) + + class RecordDeleteView(View): def get(self, request, slug, **kwargs): rec = get_object_or_404(Record, identifier=slug)