Added document tagging support
This commit is contained in:
@@ -356,7 +356,7 @@ class MetaDataImageWidget(forms.widgets.Widget):
|
|||||||
<span class="famfam active famfam-%(famfam)s"></span>%(text)s
|
<span class="famfam active famfam-%(famfam)s"></span>%(text)s
|
||||||
</button>
|
</button>
|
||||||
''' % {
|
''' % {
|
||||||
'famfam': link.get('famfam', 'link'),
|
'famfam': link.get('famfam', u'link'),
|
||||||
'text': capfirst(link['text']),
|
'text': capfirst(link['text']),
|
||||||
'action': reverse('metadatagroup_view', args=[value['current_document'].pk, value['group'].pk])
|
'action': reverse('metadatagroup_view', args=[value['current_document'].pk, value['group'].pk])
|
||||||
})
|
})
|
||||||
@@ -365,13 +365,16 @@ class MetaDataImageWidget(forms.widgets.Widget):
|
|||||||
output.append(u'<div style="white-space:nowrap; overflow: auto;">')
|
output.append(u'<div style="white-space:nowrap; overflow: auto;">')
|
||||||
for document in value['group_data']:
|
for document in value['group_data']:
|
||||||
tags_template = []
|
tags_template = []
|
||||||
|
tag_block_template = u'<div style="padding: 1px; border: 1px solid black; background: %s;">%s</div>'
|
||||||
tag_count = document.tags.count()
|
tag_count = document.tags.count()
|
||||||
if tag_count:
|
if tag_count:
|
||||||
tags_template.append(u'<div class="tc">')
|
tags_template.append(u'<div class="tc">')
|
||||||
tags_template.append(u'%(tag_string)s (%(tag_count)s): ' % {
|
tags_template.append(u'<div>%(tag_string)s: %(tag_count)s</div>' % {
|
||||||
'tag_string': _(u'Tags'), 'tag_count': tag_count})
|
'tag_string': _(u'Tags'), 'tag_count': tag_count})
|
||||||
|
|
||||||
tags_template.append(u', '.join(document.tags.values_list('name', flat=True)))
|
for tag in document.tags.all():
|
||||||
|
tags_template.append(tag_block_template % (tag.tagproperties_set.get().get_color_code(), tag.name))
|
||||||
|
|
||||||
tags_template.append(u'</div>')
|
tags_template.append(u'</div>')
|
||||||
|
|
||||||
output.append(
|
output.append(
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -289,15 +289,30 @@ def document_view(request, document_id):
|
|||||||
'object': document,
|
'object': document,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
subtemplates_dict = [
|
|
||||||
|
subtemplates_dict = []
|
||||||
|
if document.tags.count():
|
||||||
|
subtemplates_dict.append(
|
||||||
{
|
{
|
||||||
'name': 'generic_list_subtemplate.html',
|
'name': 'generic_list_subtemplate.html',
|
||||||
'title': _(u'metadata'),
|
'title': _(u'tags'),
|
||||||
'object_list': document.documentmetadata_set.all(),
|
'object_list': document.tags.all(),
|
||||||
'extra_columns': [{'name':_(u'value'), 'attribute':'value'}],
|
'extra_columns': [
|
||||||
|
{'name': _(u'color'), 'attribute': lambda x: u'<div style="width: 20px; height: 20px; border: 1px solid black; background: %s;"></div>' % x.tagproperties_set.get().get_color_code()}
|
||||||
|
],
|
||||||
'hide_link': True,
|
'hide_link': True,
|
||||||
},
|
}
|
||||||
]
|
)
|
||||||
|
|
||||||
|
subtemplates_dict.append(
|
||||||
|
{
|
||||||
|
'name': 'generic_list_subtemplate.html',
|
||||||
|
'title': _(u'metadata'),
|
||||||
|
'object_list': document.documentmetadata_set.all(),
|
||||||
|
'extra_columns': [{'name': _(u'value'), 'attribute': 'value'}],
|
||||||
|
'hide_link': True,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
metadata_groups, errors = document.get_metadata_groups()
|
metadata_groups, errors = document.get_metadata_groups()
|
||||||
if (request.user.is_staff or request.user.is_superuser) and errors:
|
if (request.user.is_staff or request.user.is_superuser) and errors:
|
||||||
@@ -333,6 +348,7 @@ def document_view(request, document_id):
|
|||||||
return render_to_response('generic_detail.html', {
|
return render_to_response('generic_detail.html', {
|
||||||
'form_list': form_list,
|
'form_list': form_list,
|
||||||
'object': document,
|
'object': document,
|
||||||
|
'document': document,
|
||||||
'subtemplates_dict': subtemplates_dict,
|
'subtemplates_dict': subtemplates_dict,
|
||||||
}, context_instance=RequestContext(request))
|
}, context_instance=RequestContext(request))
|
||||||
|
|
||||||
@@ -832,8 +848,22 @@ def document_view_simple(request, document_id):
|
|||||||
'object': document,
|
'object': document,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
subtemplates_dict = []
|
||||||
|
if document.tags.count():
|
||||||
|
subtemplates_dict.append(
|
||||||
|
{
|
||||||
|
'name': 'generic_list_subtemplate.html',
|
||||||
|
'title': _(u'tags'),
|
||||||
|
'object_list': document.tags.all(),
|
||||||
|
'extra_columns': [
|
||||||
|
{'name': _(u'color'), 'attribute': lambda x: u'<div style="width: 20px; height: 20px; border: 1px solid black; background: %s;"></div>' % x.tagproperties_set.get().get_color_code()}
|
||||||
|
],
|
||||||
|
'hide_link': True,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
subtemplates_dict = [
|
subtemplates_dict.append(
|
||||||
{
|
{
|
||||||
'name': 'generic_list_subtemplate.html',
|
'name': 'generic_list_subtemplate.html',
|
||||||
'title': _(u'metadata'),
|
'title': _(u'metadata'),
|
||||||
@@ -841,7 +871,7 @@ def document_view_simple(request, document_id):
|
|||||||
'extra_columns': [{'name': _(u'value'), 'attribute': 'value'}],
|
'extra_columns': [{'name': _(u'value'), 'attribute': 'value'}],
|
||||||
'hide_link': True,
|
'hide_link': True,
|
||||||
},
|
},
|
||||||
]
|
)
|
||||||
|
|
||||||
metadata_groups, errors = document.get_metadata_groups()
|
metadata_groups, errors = document.get_metadata_groups()
|
||||||
if (request.user.is_staff or request.user.is_superuser) and errors:
|
if (request.user.is_staff or request.user.is_superuser) and errors:
|
||||||
@@ -869,16 +899,6 @@ def document_view_simple(request, document_id):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
subtemplates_dict.append(
|
|
||||||
{
|
|
||||||
'name': 'generic_list_subtemplate.html',
|
|
||||||
'title': _(u'tags'),
|
|
||||||
'object_list': document.tags.all(),
|
|
||||||
#'extra_columns': [{'name': _(u'value'), 'attribute': 'value'}],
|
|
||||||
'hide_link': True,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return render_to_response('generic_detail.html', {
|
return render_to_response('generic_detail.html', {
|
||||||
'form_list': form_list,
|
'form_list': form_list,
|
||||||
'object': document,
|
'object': document,
|
||||||
|
|||||||
Binary file not shown.
@@ -8,8 +8,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2011-04-21 04:25-0400\n"
|
"POT-Creation-Date: 2011-04-28 00:38-0400\n"
|
||||||
"PO-Revision-Date: 2011-04-21 04:29\n"
|
"PO-Revision-Date: 2011-04-28 00:38\n"
|
||||||
"Last-Translator: Roberto Rosario <rosario_r@jp.pr.gov>\n"
|
"Last-Translator: Roberto Rosario <rosario_r@jp.pr.gov>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@@ -19,31 +19,35 @@ msgstr ""
|
|||||||
"X-Translated-Using: django-rosetta 0.5.6\n"
|
"X-Translated-Using: django-rosetta 0.5.6\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
#: __init__.py:10
|
#: __init__.py:9
|
||||||
msgid "folder list"
|
msgid "folder list"
|
||||||
msgstr "lista de carpetas"
|
msgstr "lista de carpetas"
|
||||||
|
|
||||||
#: __init__.py:11 views.py:49
|
#: __init__.py:10 views.py:48
|
||||||
msgid "create folder"
|
msgid "create folder"
|
||||||
msgstr "crear una carpeta"
|
msgstr "crear una carpeta"
|
||||||
|
|
||||||
#: __init__.py:12
|
#: __init__.py:11
|
||||||
msgid "edit"
|
msgid "edit"
|
||||||
msgstr "editar"
|
msgstr "editar"
|
||||||
|
|
||||||
#: __init__.py:13
|
#: __init__.py:12
|
||||||
msgid "delete"
|
msgid "delete"
|
||||||
msgstr "eliminar"
|
msgstr "eliminar"
|
||||||
|
|
||||||
#: __init__.py:14
|
#: __init__.py:13
|
||||||
msgid "remove"
|
msgid "remove"
|
||||||
msgstr "quitar"
|
msgstr "quitar"
|
||||||
|
|
||||||
#: __init__.py:23 models.py:31 views.py:25
|
#: __init__.py:22 models.py:31 views.py:24
|
||||||
msgid "folders"
|
msgid "folders"
|
||||||
msgstr "carpetas"
|
msgstr "carpetas"
|
||||||
|
|
||||||
#: forms.py:19
|
#: forms.py:20
|
||||||
|
msgid "Existing folders"
|
||||||
|
msgstr "Carpetas existentes"
|
||||||
|
|
||||||
|
#: forms.py:22
|
||||||
msgid "New folder"
|
msgid "New folder"
|
||||||
msgstr "Nueva carpeta"
|
msgstr "Nueva carpeta"
|
||||||
|
|
||||||
@@ -59,15 +63,15 @@ msgstr "usuario"
|
|||||||
msgid "datetime created"
|
msgid "datetime created"
|
||||||
msgstr "fecha y hora creados"
|
msgstr "fecha y hora creados"
|
||||||
|
|
||||||
#: models.py:30 models.py:35 views.py:104 views.py:138
|
#: models.py:30 models.py:35 views.py:103 views.py:137
|
||||||
msgid "folder"
|
msgid "folder"
|
||||||
msgstr "carpeta"
|
msgstr "carpeta"
|
||||||
|
|
||||||
#: models.py:36 views.py:125
|
#: models.py:36 views.py:124
|
||||||
msgid "document"
|
msgid "document"
|
||||||
msgstr "documento"
|
msgstr "documento"
|
||||||
|
|
||||||
#: models.py:42 views.py:200
|
#: models.py:42 views.py:199
|
||||||
msgid "folder document"
|
msgid "folder document"
|
||||||
msgstr "documento de carpeta"
|
msgstr "documento de carpeta"
|
||||||
|
|
||||||
@@ -75,95 +79,95 @@ msgstr "documento de carpeta"
|
|||||||
msgid "folders documents"
|
msgid "folders documents"
|
||||||
msgstr "documentos de carpeta"
|
msgstr "documentos de carpeta"
|
||||||
|
|
||||||
#: views.py:28
|
#: views.py:27
|
||||||
msgid "created"
|
msgid "created"
|
||||||
msgstr "creado"
|
msgstr "creado"
|
||||||
|
|
||||||
#: views.py:29
|
#: views.py:28
|
||||||
msgid "documents"
|
msgid "documents"
|
||||||
msgstr "documentos"
|
msgstr "documentos"
|
||||||
|
|
||||||
#: views.py:41 views.py:155
|
#: views.py:40 views.py:154
|
||||||
msgid "Folder created successfully"
|
msgid "Folder created successfully"
|
||||||
msgstr "Carpeta creada con éxito"
|
msgstr "Carpeta creada con éxito"
|
||||||
|
|
||||||
#: views.py:44 views.py:157
|
#: views.py:43 views.py:156
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "A folder named: %s, already exists."
|
msgid "A folder named: %s, already exists."
|
||||||
msgstr "Una carpeta con el nombre: %s, ya existe."
|
msgstr "Una carpeta con el nombre: %s, ya existe."
|
||||||
|
|
||||||
#: views.py:67
|
#: views.py:66
|
||||||
msgid "Folder edited successfully"
|
msgid "Folder edited successfully"
|
||||||
msgstr "Carpeta editada con éxito"
|
msgstr "Carpeta editada con éxito"
|
||||||
|
|
||||||
#: views.py:70
|
#: views.py:69
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Error editing folder; %s"
|
msgid "Error editing folder; %s"
|
||||||
msgstr "Error editando carpeta; %s"
|
msgstr "Error editando carpeta; %s"
|
||||||
|
|
||||||
#: views.py:75
|
#: views.py:74
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "edit folder: %s"
|
msgid "edit folder: %s"
|
||||||
msgstr "editar carpeta: %s"
|
msgstr "editar carpeta: %s"
|
||||||
|
|
||||||
#: views.py:96
|
#: views.py:95
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Folder: %s deleted successfully."
|
msgid "Folder: %s deleted successfully."
|
||||||
msgstr "Carpeta: %s eliminada con éxito."
|
msgstr "Carpeta: %s eliminada con éxito."
|
||||||
|
|
||||||
#: views.py:98
|
#: views.py:97
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Folder: %(folder)s delete error: %(error)s"
|
msgid "Folder: %(folder)s delete error: %(error)s"
|
||||||
msgstr "Carpeta: %(folder)s error de eliminación: %(error)s "
|
msgstr "Carpeta: %(folder)s error de eliminación: %(error)s "
|
||||||
|
|
||||||
#: views.py:109
|
#: views.py:108
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Are you sure you with to delete the folder: %s?"
|
msgid "Are you sure you with to delete the folder: %s?"
|
||||||
msgstr "¿Está seguro de que desea eliminar la carpeta: %s?"
|
msgstr "¿Está seguro de que desea eliminar la carpeta: %s?"
|
||||||
|
|
||||||
#: views.py:128
|
#: views.py:127
|
||||||
msgid "thumbnail"
|
msgid "thumbnail"
|
||||||
msgstr "miniatura"
|
msgstr "miniatura"
|
||||||
|
|
||||||
#: views.py:135
|
#: views.py:134
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "documents in folder: %s"
|
msgid "documents in folder: %s"
|
||||||
msgstr "documentos en la carpeta: %s"
|
msgstr "documentos en la carpeta: %s"
|
||||||
|
|
||||||
#: views.py:160
|
#: views.py:159
|
||||||
msgid "Must specify a new folder or an existing one."
|
msgid "Must specify a new folder or an existing one."
|
||||||
msgstr "Debe especificar una carpeta nueva o una ya existente."
|
msgstr "Debe especificar una carpeta nueva o una ya existente."
|
||||||
|
|
||||||
#: views.py:165
|
#: views.py:164
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Document: %(document)s added to folder: %(folder)s successfully."
|
msgid "Document: %(document)s added to folder: %(folder)s successfully."
|
||||||
msgstr "Documento: %(document)s agregado a la carpeta: %(folder)s exitosamente."
|
msgstr "Documento: %(document)s agregado a la carpeta: %(folder)s exitosamente."
|
||||||
|
|
||||||
#: views.py:168
|
#: views.py:167
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Document: %(document)s is already in folder: %(folder)s."
|
msgid "Document: %(document)s is already in folder: %(folder)s."
|
||||||
msgstr "Documento: %(document)s ya está en la carpeta: %(folder)s."
|
msgstr "Documento: %(document)s ya está en la carpeta: %(folder)s."
|
||||||
|
|
||||||
#: views.py:182
|
#: views.py:181
|
||||||
msgid "Must provide at least one folder document."
|
msgid "Must provide at least one folder document."
|
||||||
msgstr "Debe proveer al menos un documento de carpeta."
|
msgstr "Debe proveer al menos un documento de carpeta."
|
||||||
|
|
||||||
#: views.py:192
|
#: views.py:191
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Document: %s removed successfully."
|
msgid "Document: %s removed successfully."
|
||||||
msgstr "Documento: %s removido exitosamente."
|
msgstr "Documento: %s removido exitosamente."
|
||||||
|
|
||||||
#: views.py:194
|
#: views.py:193
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Document: %(document)s delete error: %(error)s"
|
msgid "Document: %(document)s delete error: %(error)s"
|
||||||
msgstr "Documento: %(document)s error de remoción: %(error)s "
|
msgstr "Documento: %(document)s error de remoción: %(error)s "
|
||||||
|
|
||||||
#: views.py:206
|
#: views.py:205
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Are you sure you wish to remove the document: %s?"
|
msgid "Are you sure you wish to remove the document: %s?"
|
||||||
msgstr "¿Está seguro que desea remover el documento: %s?"
|
msgstr "¿Está seguro que desea remover el documento: %s?"
|
||||||
|
|
||||||
#: views.py:208
|
#: views.py:207
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Are you sure you wish to remove the documents: %s?"
|
msgid "Are you sure you wish to remove the documents: %s?"
|
||||||
msgstr "¿Está seguro que desea eliminar los documentos: %s?"
|
msgstr "¿Está seguro que desea eliminar los documentos: %s?"
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ register_multi_item_links(['queue_document_list'], [re_queue_multiple_document,
|
|||||||
register_menu([
|
register_menu([
|
||||||
{'text': _('OCR'), 'view': 'queue_document_list', 'links':[
|
{'text': _('OCR'), 'view': 'queue_document_list', 'links':[
|
||||||
queue_document_list, node_active_list
|
queue_document_list, node_active_list
|
||||||
], 'famfam': 'hourglass', 'position': 4}])
|
], 'famfam': 'hourglass', 'position': 5}])
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -7,9 +7,29 @@ from navigation.api import register_sidebar_template
|
|||||||
|
|
||||||
from taggit.models import Tag
|
from taggit.models import Tag
|
||||||
|
|
||||||
tag_delete = {'text': _('delete'), 'view': 'tag_remove', 'args': ['object.id', 'document.id'], 'famfam': 'tag_blue_delete'}#, 'permissions': {'namespace': 'documents', 'permissions': [PERMISSION_DOCUMENT_DELETE]}}
|
PERMISSION_TAG_CREATE = 'tag_create'
|
||||||
|
PERMISSION_TAG_ATTACH = 'tag_attach'
|
||||||
|
PERMISSION_TAG_DELETE = 'tag_delete'
|
||||||
|
|
||||||
|
register_permissions('tags', [
|
||||||
|
{'name': PERMISSION_TAG_CREATE, 'label': _(u'Can create new tags')},
|
||||||
|
{'name': PERMISSION_TAG_ATTACH, 'label': _(u'Can attach exising tags')},
|
||||||
|
{'name': PERMISSION_TAG_DELETE, 'label': _(u'Can delete tags')},
|
||||||
|
])
|
||||||
|
|
||||||
|
tag_list = {'text': _('tags'), 'view': 'tag_list', 'famfam': 'tag_blue'}
|
||||||
|
tag_delete = {'text': _('delete'), 'view': 'tag_remove', 'args': ['object.id', 'document.id'], 'famfam': 'tag_blue_delete', 'permissions': {'namespace': 'tags', 'permissions': [PERMISSION_TAG_DELETE]}}
|
||||||
|
|
||||||
register_links(Tag, [tag_delete])
|
register_links(Tag, [tag_delete])
|
||||||
|
|
||||||
register_sidebar_template(['document_view', 'document_view_simple'], 'tags_sidebar_template.html')
|
register_sidebar_template(['document_view', 'document_view_simple'], 'tags_sidebar_template.html')
|
||||||
|
|
||||||
|
tags_menu = [
|
||||||
|
{
|
||||||
|
'text': _(u'tags'), 'view': 'tag_list', 'famfam': 'tag_blue', 'position': 4, 'links': [
|
||||||
|
tag_list
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
#register_menu(tags_menu)
|
||||||
|
|||||||
11
apps/tags/admin.py
Normal file
11
apps/tags/admin.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from tags.models import TagProperties
|
||||||
|
|
||||||
|
|
||||||
|
#class PermissionAdmin(admin.ModelAdmin):
|
||||||
|
# inlines = [PermissionHolderInline]
|
||||||
|
# list_display = ('namespace', 'name', 'label')
|
||||||
|
# list_display_links = list_display
|
||||||
|
|
||||||
|
admin.site.register(TagProperties)
|
||||||
@@ -1,29 +1,12 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from taggit.models import Tag
|
from taggit.models import Tag
|
||||||
|
|
||||||
|
from models import COLOR_CHOICES
|
||||||
#class FolderForm(forms.ModelForm):
|
|
||||||
# class Meta:
|
|
||||||
# model = Folder
|
|
||||||
# fields = ('title',)
|
|
||||||
|
|
||||||
|
|
||||||
class AddTagForm(forms.ModelForm):
|
class AddTagForm(forms.Form):
|
||||||
def __init__(self, *args, **kwargs):
|
new_tag = forms.CharField(required=False, label=_(u'New tag'))
|
||||||
#user = kwargs.pop('user', None)
|
color = forms.ChoiceField(choices=COLOR_CHOICES, required=False, label=_(u'Color'))
|
||||||
super(AddTagForm, self).__init__(*args, **kwargs)
|
existing_tags = forms.ModelChoiceField(required=False, queryset=Tag.objects.all(), label=_(u'Existing tags'))
|
||||||
#self.fields['title'].required = False
|
|
||||||
#self.fields['title'].label = _(u'New folder')
|
|
||||||
|
|
||||||
self.fields['existing_tags'] = forms.ModelChoiceField(
|
|
||||||
required=False,
|
|
||||||
queryset=Tag.objects.all(), #(user=user),
|
|
||||||
label=_(u'Existing tags'))
|
|
||||||
self.fields['name'].required = False
|
|
||||||
self.fields['name'].label = _(u'New tag')
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = Tag
|
|
||||||
fields = ('name',)
|
|
||||||
|
|||||||
BIN
apps/tags/locale/es/LC_MESSAGES/django.mo
Normal file
BIN
apps/tags/locale/es/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
95
apps/tags/locale/es/LC_MESSAGES/django.po
Normal file
95
apps/tags/locale/es/LC_MESSAGES/django.po
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2011-04-28 00:14-0400\n"
|
||||||
|
"PO-Revision-Date: 2011-04-28 00:17\n"
|
||||||
|
"Last-Translator: Roberto Rosario <rosario_r@jp.pr.gov>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Language: \n"
|
||||||
|
"X-Translated-Using: django-rosetta 0.5.6\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
|
#: __init__.py:10
|
||||||
|
msgid "delete"
|
||||||
|
msgstr "eliminar"
|
||||||
|
|
||||||
|
#: forms.py:15
|
||||||
|
msgid "New tag"
|
||||||
|
msgstr "Nueva etiqueta"
|
||||||
|
|
||||||
|
#: forms.py:16
|
||||||
|
msgid "Color"
|
||||||
|
msgstr "Color"
|
||||||
|
|
||||||
|
#: forms.py:17
|
||||||
|
msgid "Existing tags"
|
||||||
|
msgstr "Etiquetas existentes"
|
||||||
|
|
||||||
|
#: models.py:14
|
||||||
|
msgid "Blue"
|
||||||
|
msgstr "Azul"
|
||||||
|
|
||||||
|
#: models.py:15
|
||||||
|
msgid "Cyan"
|
||||||
|
msgstr "Cian"
|
||||||
|
|
||||||
|
#: models.py:16
|
||||||
|
msgid "Green-Yellow"
|
||||||
|
msgstr "Verde-Amarillo"
|
||||||
|
|
||||||
|
#: models.py:17
|
||||||
|
msgid "Magenta"
|
||||||
|
msgstr "Magenta"
|
||||||
|
|
||||||
|
#: models.py:18
|
||||||
|
msgid "Red"
|
||||||
|
msgstr "Rojo"
|
||||||
|
|
||||||
|
#: models.py:19
|
||||||
|
msgid "Yellow"
|
||||||
|
msgstr "Amarillo"
|
||||||
|
|
||||||
|
#: models.py:33
|
||||||
|
msgid "tag"
|
||||||
|
msgstr "etiqueta"
|
||||||
|
|
||||||
|
#: models.py:34
|
||||||
|
msgid "color"
|
||||||
|
msgstr "color"
|
||||||
|
|
||||||
|
#: models.py:37
|
||||||
|
msgid "tag properties"
|
||||||
|
msgstr "propiedades de etiqueta"
|
||||||
|
|
||||||
|
#: models.py:38
|
||||||
|
msgid "tags properties"
|
||||||
|
msgstr "propiedades de etiquetas"
|
||||||
|
|
||||||
|
#: views.py:25
|
||||||
|
#, python-format
|
||||||
|
msgid "Tag \"%s\" removed successfully."
|
||||||
|
msgstr "Etiqueta \"%s\" eliminada exitosamente."
|
||||||
|
|
||||||
|
#: views.py:52
|
||||||
|
#, python-format
|
||||||
|
msgid "Document is already tagged as \"%s\""
|
||||||
|
msgstr "Documento ya está etiquetado como \"%s\""
|
||||||
|
|
||||||
|
#: views.py:61
|
||||||
|
#, python-format
|
||||||
|
msgid "Tag \"%s\" added successfully."
|
||||||
|
msgstr "Etiqueta \"%s\", agregada exitosamente."
|
||||||
|
|
||||||
|
#: templatetags/tags_tags.py:17
|
||||||
|
msgid "Add tag to document"
|
||||||
|
msgstr "Agregar etiqueta al documento"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from taggit.models import Tag
|
from taggit.models import Tag
|
||||||
|
|
||||||
@@ -8,21 +8,24 @@ COLOR_BLUE = u'blu'
|
|||||||
COLOR_MAGENTA = u'mag'
|
COLOR_MAGENTA = u'mag'
|
||||||
COLOR_CYAN = u'cya'
|
COLOR_CYAN = u'cya'
|
||||||
COLOR_YELLOW = u'yel'
|
COLOR_YELLOW = u'yel'
|
||||||
|
COLOR_GREENYELLOW = u'gry'
|
||||||
|
|
||||||
COLOR_CHOICES = (
|
COLOR_CHOICES = (
|
||||||
(COLOR_RED, _(u'red')),
|
(COLOR_BLUE, _(u'Blue')),
|
||||||
(COLOR_BLUE, _(u'blue')),
|
(COLOR_CYAN, _(u'Cyan')),
|
||||||
# (COLOR_MAGENTA, _(u'magenta')),
|
(COLOR_GREENYELLOW, _(u'Green-Yellow')),
|
||||||
# (COLOR_CYAN, _(u'cyan')),
|
(COLOR_MAGENTA, _(u'Magenta')),
|
||||||
(COLOR_YELLOW, _(u'yellow'))
|
(COLOR_RED, _(u'Red')),
|
||||||
|
(COLOR_YELLOW, _(u'Yellow'))
|
||||||
)
|
)
|
||||||
|
|
||||||
COLOR_CODES = (
|
COLOR_CODES = (
|
||||||
(COLOR_RED, u'FF0000'),
|
(COLOR_RED, u'red'),
|
||||||
(COLOR_BLUE, u'0000FF'),
|
(COLOR_BLUE, u'blue'),
|
||||||
# (COLOR_MAGENTA, u'FF0000'),
|
(COLOR_MAGENTA, u'magenta'),
|
||||||
# (COLOR_CYAN, u'FF0000'),
|
(COLOR_CYAN, u'cyan'),
|
||||||
(COLOR_YELLOW, u'00FFFF')
|
(COLOR_YELLOW, u'yellow'),
|
||||||
|
(COLOR_GREENYELLOW, u'greenyellow '),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -35,4 +38,7 @@ class TagProperties(models.Model):
|
|||||||
verbose_name_plural = _(u'tags properties')
|
verbose_name_plural = _(u'tags properties')
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.tag
|
return unicode(self.tag)
|
||||||
|
|
||||||
|
def get_color_code(self):
|
||||||
|
return dict(COLOR_CODES)[self.color]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ register = Library()
|
|||||||
@register.inclusion_tag('generic_form_subtemplate.html', takes_context=True)
|
@register.inclusion_tag('generic_form_subtemplate.html', takes_context=True)
|
||||||
def get_add_tag_to_document_form(context):
|
def get_add_tag_to_document_form(context):
|
||||||
context.update({
|
context.update({
|
||||||
'form': AddTagForm(),#user=context['request'].user),
|
'form': AddTagForm(),
|
||||||
'request': context['request'],
|
'request': context['request'],
|
||||||
'form_action': reverse('tag_add', args=[context['document'].pk]),
|
'form_action': reverse('tag_add', args=[context['document'].pk]),
|
||||||
'title': _('Add tag to document')
|
'title': _('Add tag to document')
|
||||||
|
|||||||
@@ -1,17 +1,7 @@
|
|||||||
from django.conf.urls.defaults import patterns, url
|
from django.conf.urls.defaults import patterns, url
|
||||||
|
|
||||||
urlpatterns = patterns('tags.views',
|
urlpatterns = patterns('tags.views',
|
||||||
url(r'^(?P<tag_id>\d+)/remove_from_document/(?P<document_id>\d+)$', 'tag_remove', (), 'tag_remove'),
|
url(r'^list/$', 'tag_list', (), 'tag_list'),
|
||||||
url(r'^add_to_document/(?P<document_id>\d+)$', 'tag_add', (), 'tag_add'),
|
url(r'^(?P<tag_id>\d+)/remove_from_document/(?P<document_id>\d+)/$', 'tag_remove', (), 'tag_remove'),
|
||||||
# url(r'^ocr/queue/document/list/$', 'queue_document_list', (), 'queue_document_list'),
|
url(r'^add_to_document/(?P<document_id>\d+)/$', 'tag_add', (), 'tag_add'),
|
||||||
# url(r'^ocr/queue/document/(?P<queue_document_id>\d+)/delete/$', 'queue_document_delete', (), 'queue_document_delete'),
|
|
||||||
# url(r'^ocr/queue/document/multiple/delete/$', 'queue_document_multiple_delete', (), 'queue_document_multiple_delete'),
|
|
||||||
# url(r'^ocr/queue/document/(?P<queue_document_id>\d+)/re-queue/$', 're_queue_document', (), 're_queue_document'),
|
|
||||||
# url(r'^ocr/queue/document/multiple/re-queue/$', 're_queue_multiple_document', (), 're_queue_multiple_document'),#
|
|
||||||
|
|
||||||
# url(r'^ocr/queue/(?P<document_queue_id>\d+)/enable/$', 'document_queue_enable', (), 'document_queue_enable'),#
|
|
||||||
# url(r'^ocr/queue/(?P<document_queue_id>\d+)/disable/$', 'document_queue_disable', (), 'document_queue_disable'),
|
|
||||||
|
|
||||||
# url(r'^ocr/document/all/clean_up/$', 'all_document_ocr_cleanup', (), 'all_document_ocr_cleanup'),
|
|
||||||
# url(r'^ocr/node/active/list/$', 'node_active_list', (), 'node_active_list'),
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,43 +11,67 @@ from taggit.models import Tag
|
|||||||
from documents.models import Document
|
from documents.models import Document
|
||||||
|
|
||||||
from tags.forms import AddTagForm
|
from tags.forms import AddTagForm
|
||||||
|
from tags.models import TagProperties
|
||||||
|
from tags import PERMISSION_TAG_CREATE, PERMISSION_TAG_ATTACH, \
|
||||||
|
PERMISSION_TAG_DELETE
|
||||||
|
|
||||||
|
|
||||||
def tag_remove(request, tag_id, document_id):
|
def tag_remove(request, tag_id, document_id):
|
||||||
# check_permissions(request.user, 'ocr', [PERMISSION_OCR_DOCUMENT])
|
check_permissions(request.user, 'tags', [PERMISSION_TAG_DELETE])
|
||||||
|
|
||||||
tag = get_object_or_404(Tag, pk=tag_id)
|
tag = get_object_or_404(Tag, pk=tag_id)
|
||||||
document = get_object_or_404(Document, pk=document_id)
|
document = get_object_or_404(Document, pk=document_id)
|
||||||
|
|
||||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
||||||
tag.delete()
|
tag.delete()
|
||||||
messages.success(request, _(u'Tag: %s, removed successfully.') % tag)
|
messages.success(request, _(u'Tag "%s" removed successfully.') % tag)
|
||||||
|
|
||||||
return HttpResponseRedirect(previous)
|
return HttpResponseRedirect(previous)
|
||||||
|
|
||||||
|
|
||||||
def tag_add(request, document_id):
|
def tag_add(request, document_id):
|
||||||
# check_permissions(request.user, 'ocr', [PERMISSION_OCR_DOCUMENT])
|
|
||||||
|
|
||||||
document = get_object_or_404(Document, pk=document_id)
|
document = get_object_or_404(Document, pk=document_id)
|
||||||
|
|
||||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
||||||
#document.tags.add(tag)
|
|
||||||
#messages.success(request, _(u'Tag: %s, removed successfully.') % tag)
|
|
||||||
#tag = get_object_or_404(Tag, pk=tag_id)
|
|
||||||
|
|
||||||
#return HttpResponseRedirect(previous)
|
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
previous = request.META.get('HTTP_REFERER', '/')
|
previous = request.META.get('HTTP_REFERER', '/')
|
||||||
form = AddTagForm(request.POST)#, user=request.user)
|
form = AddTagForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
if form.cleaned_data['existing_tags']:
|
if form.cleaned_data['new_tag']:
|
||||||
tag = form.cleaned_data['existing_tags']
|
check_permissions(request.user, 'tags', [PERMISSION_TAG_CREATE])
|
||||||
elif form.cleaned_data['name']:
|
tag_name = form.cleaned_data['new_tag']
|
||||||
tag = form.cleaned_data['name']
|
if Tag.objects.filter(name=tag_name):
|
||||||
|
is_new = False
|
||||||
|
else:
|
||||||
|
is_new = True
|
||||||
|
elif form.cleaned_data['existing_tags']:
|
||||||
|
check_permissions(request.user, 'tags', [PERMISSION_TAG_ATTACH])
|
||||||
|
tag_name = form.cleaned_data['existing_tags']
|
||||||
|
is_new = False
|
||||||
|
else:
|
||||||
|
messages.error(request, _(u'Must choose either a new tag or an existing one.'))
|
||||||
|
return HttpResponseRedirect(previous)
|
||||||
|
|
||||||
|
if tag_name in document.tags.values_list('name', flat=True):
|
||||||
|
messages.warning(request, _(u'Document is already tagged as "%s"') % tag_name)
|
||||||
|
return HttpResponseRedirect(previous)
|
||||||
|
|
||||||
document.tags.add(tag)
|
document.tags.add(tag_name)
|
||||||
|
|
||||||
|
if is_new:
|
||||||
|
tag = Tag.objects.get(name=tag_name)
|
||||||
|
TagProperties(tag=tag, color=form.cleaned_data['color']).save()
|
||||||
|
|
||||||
|
messages.success(request, _(u'Tag "%s" added successfully.') % tag_name)
|
||||||
|
|
||||||
return HttpResponseRedirect(previous)
|
return HttpResponseRedirect(previous)
|
||||||
|
|
||||||
|
|
||||||
|
def tag_list(request):
|
||||||
|
|
||||||
|
return render_to_response('generic_list.html', {
|
||||||
|
'object_list': Tag.objects.all(),
|
||||||
|
'title': _(u'tags'),
|
||||||
|
'hide_link': True,
|
||||||
|
}, context_instance=RequestContext(request))
|
||||||
|
|||||||
Reference in New Issue
Block a user