summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-12-30 17:19:57 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-12-30 17:19:57 +0100
commit45562901b3956955d825d4b8f1914ac2e48f0463 (patch)
tree5a2ec62836501b9a6d94b04ff02bb9f0a4374d4c /ishtar_common
parentbd14b56fea4482a15ea56174d88922aafa033cde (diff)
downloadIshtar-45562901b3956955d825d4b8f1914ac2e48f0463.tar.bz2
Ishtar-45562901b3956955d825d4b8f1914ac2e48f0463.zip
Sources: duplicate and references
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/forms_common.py10
-rw-r--r--ishtar_common/models.py7
-rw-r--r--ishtar_common/templates/ishtar/sheet_source.html1
-rw-r--r--ishtar_common/templatetags/window_field.py3
4 files changed, 17 insertions, 4 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index e5cdc0bdd..ab1327913 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -574,9 +574,12 @@ class SourceForm(forms.Form):
title = forms.CharField(label=_(u"Title"),
validators=[validators.MaxLengthValidator(200)])
source_type = forms.ChoiceField(label=_(u"Source type"), choices=[])
+ reference = forms.CharField(
+ label=_(u"Reference"),
+ validators=[validators.MaxLengthValidator(100)], required=False)
internal_reference = forms.CharField(
label=_(u"Internal reference"),
- validators=[validators.MaxLengthValidator(25)], required=False)
+ validators=[validators.MaxLengthValidator(100)], required=False)
associated_url = forms.URLField(
required=False, label=_(u"Numerical ressource (web address)"))
receipt_date = forms.DateField(label=_(u"Receipt date"), required=False,
@@ -587,6 +590,8 @@ class SourceForm(forms.Form):
required=False)
description = forms.CharField(label=_(u"Description"),
widget=forms.Textarea, required=False)
+ duplicate = forms.BooleanField(label=_(u"Is a duplicate"),
+ required=False)
def __init__(self, *args, **kwargs):
super(SourceForm, self).__init__(*args, **kwargs)
@@ -602,6 +607,9 @@ class SourceSelect(TableSelect):
required=False)
source_type = forms.ChoiceField(label=_("Source type"), choices=[])
+ reference = forms.CharField(label=_(u"Reference"))
+ internal_reference = forms.CharField(label=_(u"Internal reference"))
+ duplicate = forms.NullBooleanField(label=_(u"Is a duplicate"))
def __init__(self, *args, **kwargs):
super(SourceSelect, self).__init__(*args, **kwargs)
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index ec3d2e2a6..e44d799cc 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -2151,14 +2151,15 @@ class Source(models.Model):
creation_date = models.DateField(blank=True, null=True,
verbose_name=_(u"Creation date"))
item_number = models.IntegerField(_(u"Item number"), default=1)
- reference = models.CharField(_(u"Ref."), max_length=25, null=True,
+ reference = models.CharField(_(u"Ref."), max_length=100, null=True,
blank=True)
- internal_reference = models.CharField(_(u"Internal ref."),
- max_length=25, null=True, blank=True)
+ internal_reference = models.CharField(
+ _(u"Internal ref."), max_length=100, null=True, blank=True)
description = models.TextField(_(u"Description"), blank=True, null=True)
comment = models.TextField(_(u"Comment"), blank=True, null=True)
additional_information = models.TextField(_(u"Additional information"),
blank=True, null=True)
+ duplicate = models.BooleanField(_(u"Is a duplicate"), default=False)
TABLE_COLS = ['title', 'source_type', 'authors', ]
class Meta:
diff --git a/ishtar_common/templates/ishtar/sheet_source.html b/ishtar_common/templates/ishtar/sheet_source.html
index 962608e68..9b60288c1 100644
--- a/ishtar_common/templates/ishtar/sheet_source.html
+++ b/ishtar_common/templates/ishtar/sheet_source.html
@@ -12,6 +12,7 @@
{% field "Item number" item.item_number %}
{% field "Ref." item.reference %}
{% field "Internal ref." item.internal_reference %}
+{% field "Is a duplicate" item.duplicate %}
{% field "Description" item.description %}
{% field "Comment" item.comment %}
{% field "Additional information" item.additional_information %}
diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py
index 11d00d7c9..ef247035b 100644
--- a/ishtar_common/templatetags/window_field.py
+++ b/ishtar_common/templatetags/window_field.py
@@ -1,10 +1,13 @@
from django import template
+from django.utils.translation import ugettext_lazy as _
register = template.Library()
@register.inclusion_tag('ishtar/blocks/window_field.html')
def field(caption, data, pre_data='', post_data=''):
+ if data in (True, False):
+ data = _(unicode(data))
return {'caption': caption, 'data': data, "pre_data": pre_data,
'post_data': post_data}