Merge branch 'development' into feature/ACL_support

Conflicts:
	requirements/development.txt
	requirements/production.txt
	urls.py
This commit is contained in:
Roberto Rosario
2011-12-05 16:01:21 -04:00
300 changed files with 19574 additions and 3132 deletions
+29 -35
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-30 00:54-0400\n"
"POT-Creation-Date: 2011-11-22 11:26-0400\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"
@@ -99,67 +99,67 @@ msgstr ""
msgid "Landscape"
msgstr ""
#: utils.py:289
#: utils.py:291
msgid "function found"
msgstr ""
#: utils.py:291 utils.py:293
#: utils.py:293 utils.py:295
#, python-format
msgid "class found: %s"
msgstr ""
#: views.py:23 templates/password_change_done.html:5
#: views.py:24 templates/password_change_done.html:5
msgid "Your password has been successfully changed."
msgstr ""
#: views.py:39
#: views.py:41
msgid "No action selected."
msgstr ""
#: views.py:43
#: views.py:45
msgid "Must select at least one item."
msgstr ""
#: views.py:76
#: views.py:86
#, python-format
msgid "%(selection)s added successfully added to %(right_list_title)s."
msgstr ""
#: views.py:79 views.py:96
#: views.py:89 views.py:106
#, python-format
msgid "Unable to add %(selection)s to %(right_list_title)s."
msgstr ""
#: views.py:93
#: views.py:103
#, python-format
msgid "%(selection)s added successfully removed from %(right_list_title)s."
msgstr ""
#: views.py:111
#: views.py:121
msgid "Add"
msgstr ""
#: views.py:122
#: views.py:132
msgid "Remove"
msgstr ""
#: views.py:145
#: views.py:155
msgid "current user details"
msgstr ""
#: views.py:162
#: views.py:172
msgid "Current user's details updated."
msgstr ""
#: views.py:171
#: views.py:181
msgid "edit current user details"
msgstr ""
#: views.py:197
#: views.py:207
msgid "Changelog"
msgstr ""
#: views.py:210
#: views.py:220
msgid "License"
msgstr ""
@@ -237,25 +237,25 @@ msgstr ""
msgid "Confirm delete"
msgstr ""
#: templates/generic_confirm.html:28
#: templates/generic_confirm.html:32
msgid "form icon"
msgstr ""
#: templates/generic_confirm.html:36
#: templates/generic_confirm.html:40
#, python-format
msgid "Are you sure you wish to delete %(object_name)s: %(object)s?"
msgstr ""
#: templates/generic_confirm.html:38
#: templates/generic_confirm.html:42
#, python-format
msgid "Are you sure you wish to delete: %(object)s?"
msgstr ""
#: templates/generic_confirm.html:46
#: templates/generic_confirm.html:50
msgid "Yes"
msgstr ""
#: templates/generic_confirm.html:50
#: templates/generic_confirm.html:54
msgid "No"
msgstr ""
@@ -268,8 +268,8 @@ msgstr ""
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:51
#: templates/generic_list_subtemplate.html:171
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Save"
msgstr ""
@@ -277,22 +277,18 @@ msgstr ""
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:51
#: templates/generic_list_subtemplate.html:171
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Submit"
msgstr ""
#: templates/generic_form_subtemplate.html:82
msgid "Cancel"
msgstr ""
#: templates/generic_list.html:6 templates/generic_list_horizontal.html:6
#, python-format
msgid "List of %(stripped_title)s"
msgstr ""
#: templates/generic_list_horizontal_subtemplate.html:23
#: templates/generic_list_subtemplate.html:23
#: templates/generic_list_subtemplate.html:24
#, python-format
msgid ""
"List of %(title)s (%(start)s - %(end)s out of %(total)s) (Page "
@@ -300,18 +296,16 @@ msgid ""
msgstr ""
#: templates/generic_list_horizontal_subtemplate.html:25
#: templates/generic_list_subtemplate.html:25
#: templates/generic_list_subtemplate.html:26
#, python-format
msgid "List of %(title)s (%(total)s)"
msgstr ""
#: templates/generic_list_horizontal_subtemplate.html:72
#: templates/generic_list_subtemplate.html:71
#: templates/generic_list_subtemplate.html:72
msgid "Identifier"
msgstr ""
#: templates/generic_list_horizontal_subtemplate.html:146
#: templates/generic_list_subtemplate.html:145
#: templates/generic_list_subtemplate.html:152
#, python-format
msgid "There are no %(stripped_title)s"
msgstr ""
Binary file not shown.
+49 -48
View File
@@ -1,21 +1,22 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Roberto Rosario <roberto.rosario.gonzalez@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-09-30 00:54-0400\n"
"PO-Revision-Date: 2011-09-30 05:17+0000\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-11-04 00:58+0000\n"
"Last-Translator: rosarior <roberto.rosario.gonzalez@gmail.com>\n"
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/mayan-edms/team/es/)\n"
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/"
"mayan-edms/team/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:17
@@ -32,11 +33,11 @@ msgstr "editar detalles"
#: __init__.py:23 __init__.py:29
msgid "about"
msgstr ""
msgstr "sobre"
#: __init__.py:24
msgid "changelog"
msgstr ""
msgstr "cambios"
#: __init__.py:25
msgid "license"
@@ -48,17 +49,20 @@ msgstr "Selección"
#: forms.py:131
msgid "Email"
msgstr ""
msgstr "E-mail"
#: forms.py:142
msgid ""
"Please enter a correct email and password. Note that the password fields is "
"case-sensitive."
msgstr ""
"Por favor entre la dirección de correo electrónico y la contraseña "
"correctas. Tenga en cuenta que los campos de contraseña distingue entre "
"mayúsculas y minúsculas."
#: forms.py:144
msgid "This account is inactive."
msgstr ""
msgstr "Esta cuenta está inactiva."
#: literals.py:24
msgid "A5"
@@ -100,67 +104,67 @@ msgstr "Retrato"
msgid "Landscape"
msgstr "Paisaje"
#: utils.py:289
#: utils.py:291
msgid "function found"
msgstr "función encontrada"
#: utils.py:291 utils.py:293
#: utils.py:293 utils.py:295
#, python-format
msgid "class found: %s"
msgstr "clase encontrada: %s"
#: views.py:23 templates/password_change_done.html:5
#: views.py:24 templates/password_change_done.html:5
msgid "Your password has been successfully changed."
msgstr "Su contraseña se ha modificado correctamente."
#: views.py:39
#: views.py:41
msgid "No action selected."
msgstr "Ninguna acción seleccionada."
#: views.py:43
#: views.py:45
msgid "Must select at least one item."
msgstr "Debe seleccionar al menos un artículo."
#: views.py:76
#: views.py:86
#, python-format
msgid "%(selection)s added successfully added to %(right_list_title)s."
msgstr "Se agrego exitosamente %(selection)s a %(right_list_title)s."
#: views.py:79 views.py:96
#: views.py:89 views.py:106
#, python-format
msgid "Unable to add %(selection)s to %(right_list_title)s."
msgstr "No se puede agregar %(selection)s a %(right_list_title)s."
#: views.py:93
#: views.py:103
#, python-format
msgid "%(selection)s added successfully removed from %(right_list_title)s."
msgstr "Se removió exitosamente %(selection)s de %(right_list_title)s."
#: views.py:111
#: views.py:121
msgid "Add"
msgstr "Agregar"
#: views.py:122
#: views.py:132
msgid "Remove"
msgstr "Remover"
#: views.py:145
#: views.py:155
msgid "current user details"
msgstr "detalles del usuario corriente"
#: views.py:162
#: views.py:172
msgid "Current user's details updated."
msgstr "Datos del usuario corriente actualizados."
#: views.py:171
#: views.py:181
msgid "edit current user details"
msgstr "editar detalles del usuario corriente"
#: views.py:197
#: views.py:207
msgid "Changelog"
msgstr ""
msgstr "Cambios"
#: views.py:210
#: views.py:220
msgid "License"
msgstr "Licencia"
@@ -171,8 +175,8 @@ msgstr "Ninguno"
#: conf/settings.py:15
msgid ""
"Temporary directory used site wide to store thumbnails, previews and "
"temporary files. If none is specified, one will be created using "
"tempfile.mkdtemp()"
"temporary files. If none is specified, one will be created using tempfile."
"mkdtemp()"
msgstr ""
"Directorio temporal utilizado por todo el sitio para almacenar imágenes en "
"miniatura, vistas previas y los archivos temporales. Si no se especifica "
@@ -183,6 +187,8 @@ msgid ""
"Controls the mechanism used to authenticated user. Options are: username, "
"email"
msgstr ""
"Controla el mecanismo utilizado para el usuario autenticado. Las opciones "
"son: 'username' nombre de usuario, 'email' correo electrónico"
#: templates/403.html:3 templates/403.html.py:7
msgid "Insufficient permissions"
@@ -241,25 +247,25 @@ msgstr "Confirmar"
msgid "Confirm delete"
msgstr "Confirmar eliminación"
#: templates/generic_confirm.html:28
#: templates/generic_confirm.html:32
msgid "form icon"
msgstr "emblema de la forma"
#: templates/generic_confirm.html:36
#: templates/generic_confirm.html:40
#, python-format
msgid "Are you sure you wish to delete %(object_name)s: %(object)s?"
msgstr "¿Está seguro que desea eliminar %(object_name)s: %(object)s?"
#: templates/generic_confirm.html:38
#: templates/generic_confirm.html:42
#, python-format
msgid "Are you sure you wish to delete: %(object)s?"
msgstr "¿Está seguro que desea eliminar: %(object)s?"
#: templates/generic_confirm.html:46
#: templates/generic_confirm.html:50
msgid "Yes"
msgstr "Sí"
#: templates/generic_confirm.html:50
#: templates/generic_confirm.html:54
msgid "No"
msgstr "No"
@@ -272,8 +278,8 @@ msgstr "requerido"
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:51
#: templates/generic_list_subtemplate.html:171
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Save"
msgstr "Guardar"
@@ -281,22 +287,18 @@ msgstr "Guardar"
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:51
#: templates/generic_list_subtemplate.html:171
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Submit"
msgstr "Enviar"
#: templates/generic_form_subtemplate.html:82
msgid "Cancel"
msgstr "Cancelar"
#: templates/generic_list.html:6 templates/generic_list_horizontal.html:6
#, python-format
msgid "List of %(stripped_title)s"
msgstr "Lista de %(stripped_title)s "
#: templates/generic_list_horizontal_subtemplate.html:23
#: templates/generic_list_subtemplate.html:23
#: templates/generic_list_subtemplate.html:24
#, python-format
msgid ""
"List of %(title)s (%(start)s - %(end)s out of %(total)s) (Page "
@@ -306,18 +308,16 @@ msgstr ""
"%(page_number)s de %(total_pages)s)"
#: templates/generic_list_horizontal_subtemplate.html:25
#: templates/generic_list_subtemplate.html:25
#: templates/generic_list_subtemplate.html:26
#, python-format
msgid "List of %(title)s (%(total)s)"
msgstr "Lista de %(title)s (%(total)s)"
#: templates/generic_list_horizontal_subtemplate.html:72
#: templates/generic_list_subtemplate.html:71
#: templates/generic_list_subtemplate.html:72
msgid "Identifier"
msgstr "Identificador"
#: templates/generic_list_horizontal_subtemplate.html:146
#: templates/generic_list_subtemplate.html:145
#: templates/generic_list_subtemplate.html:152
#, python-format
msgid "There are no %(stripped_title)s"
msgstr "No hay %(stripped_title)s "
@@ -331,4 +331,5 @@ msgstr "Iniciar sesión"
msgid "Password change"
msgstr "Cambio de contraseña"
#~ msgid "Cancel"
#~ msgstr "Cancelar"
Binary file not shown.
+334
View File
@@ -0,0 +1,334 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# <dev.emerson@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-11-02 02:18+0000\n"
"Last-Translator: emersonsoares <dev.emerson@gmail.com>\n"
"Language-Team: Portuguese (http://www.transifex.net/projects/p/mayan-edms/"
"team/pt/)\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:17
msgid "change password"
msgstr "alterar a senha"
#: __init__.py:18
msgid "user details"
msgstr "detalhes do usuário"
#: __init__.py:19
msgid "edit details"
msgstr "editar detalhes"
#: __init__.py:23 __init__.py:29
msgid "about"
msgstr "sobre"
#: __init__.py:24
msgid "changelog"
msgstr "log de alterações"
#: __init__.py:25
msgid "license"
msgstr "licença"
#: forms.py:99
msgid "Selection"
msgstr "Seleção"
#: forms.py:131
msgid "Email"
msgstr "E-mail"
#: forms.py:142
msgid ""
"Please enter a correct email and password. Note that the password fields is "
"case-sensitive."
msgstr ""
"Por favor insira o e-mail e senha corretos. Note que os campos de senha são "
"case-sensitive."
#: forms.py:144
msgid "This account is inactive."
msgstr "Esta conta está inativa."
#: literals.py:24
msgid "A5"
msgstr "A5"
#: literals.py:25
msgid "A4"
msgstr "A4"
#: literals.py:26
msgid "A3"
msgstr "A3"
#: literals.py:27
msgid "B5"
msgstr "B5"
#: literals.py:28
msgid "B4"
msgstr "B4"
#: literals.py:29
msgid "Letter"
msgstr "Carta"
#: literals.py:30
msgid "Legal"
msgstr "Legal"
#: literals.py:31
msgid "Ledger"
msgstr "Livro-razão"
#: literals.py:38
msgid "Portrait"
msgstr "Retrato"
#: literals.py:39
msgid "Landscape"
msgstr "Paisagem"
#: utils.py:291
msgid "function found"
msgstr "função encontrada"
#: utils.py:293 utils.py:295
#, python-format
msgid "class found: %s"
msgstr "classe encontrada: %s"
#: views.py:24 templates/password_change_done.html:5
msgid "Your password has been successfully changed."
msgstr "Sua senha foi alterada com êxito."
#: views.py:41
msgid "No action selected."
msgstr "Nenhuma ação selecionada."
#: views.py:45
msgid "Must select at least one item."
msgstr "Deve selecionar pelo menos um item."
#: views.py:86
#, python-format
msgid "%(selection)s added successfully added to %(right_list_title)s."
msgstr "%(selection)s adicionadas com sucesso a %(right_list_title)s ."
#: views.py:89 views.py:106
#, python-format
msgid "Unable to add %(selection)s to %(right_list_title)s."
msgstr "Não foi possível adicionar %(selection)s para %(right_list_title)s ."
#: views.py:103
#, python-format
msgid "%(selection)s added successfully removed from %(right_list_title)s."
msgstr " %(selection)s adicionado com sucesso removidos %(right_list_title)s."
#: views.py:121
msgid "Add"
msgstr "Adicionar"
#: views.py:132
msgid "Remove"
msgstr "Remover"
#: views.py:155
msgid "current user details"
msgstr "detalhes atuais do usuário"
#: views.py:172
msgid "Current user's details updated."
msgstr "Detalhes do usuário atual atualizados."
#: views.py:181
msgid "edit current user details"
msgstr "editar os detalhes do usuário atual"
#: views.py:207
msgid "Changelog"
msgstr "Log de alterações"
#: views.py:220
msgid "License"
msgstr "Licença"
#: widgets.py:58
msgid "None"
msgstr "Nenhum"
#: conf/settings.py:15
msgid ""
"Temporary directory used site wide to store thumbnails, previews and "
"temporary files. If none is specified, one will be created using tempfile."
"mkdtemp()"
msgstr ""
"Diretório temporário usado para armazenar miniaturas, previews e arquivos "
"temporários. Se nenhum for especificado, um será criado usando tempfile."
"mkdtemp()"
#: conf/settings.py:65
msgid ""
"Controls the mechanism used to authenticated user. Options are: username, "
"email"
msgstr ""
"Controla o mecanismo usado para usuário autenticado. As opções são: e-mail, "
"nome de usuário,"
#: templates/403.html:3 templates/403.html.py:7
msgid "Insufficient permissions"
msgstr "Permissões insuficientes"
#: templates/403.html:9
msgid "You don't have enough permissions for this operation."
msgstr "Você não tem permissões suficientes para esta operação."
#: templates/404.html:3 templates/404.html.py:7
msgid "Page not found"
msgstr "Página não encontrada"
#: templates/404.html:9
msgid "Sorry, but the requested page could not be found."
msgstr "Desculpe, mas a página solicitada não pôde ser encontrada."
#: templates/calculate_form_title.html:11
#, python-format
msgid "Details for %(object_name)s: %(object)s"
msgstr "Detalhes para %(object_name)s : %(object)s "
#: templates/calculate_form_title.html:13
#, python-format
msgid "Details for: %(object)s"
msgstr "Detalhes para: %(object)s "
#: templates/calculate_form_title.html:18
#, python-format
msgid "Edit %(object_name)s:"
msgstr "Editar %(object_name)s:"
#: templates/calculate_form_title.html:20
msgid "Edit"
msgstr "Editar"
#: templates/calculate_form_title.html:24
#, python-format
msgid "Create new %(object_name)s"
msgstr "Criar novas %(object_name)s "
#: templates/calculate_form_title.html:26
msgid "Create"
msgstr "Criar"
#: templates/generic_assign_remove.html:3
#, python-format
msgid "Assign %(title)s %(object)s"
msgstr "Atribuir %(title)s %(object)s "
#: templates/generic_confirm.html:3 templates/generic_confirm.html.py:18
msgid "Confirm"
msgstr "Confirmar"
#: templates/generic_confirm.html:16
msgid "Confirm delete"
msgstr "Confirmar exclusão"
#: templates/generic_confirm.html:32
msgid "form icon"
msgstr "ícone de formulário"
#: templates/generic_confirm.html:40
#, python-format
msgid "Are you sure you wish to delete %(object_name)s: %(object)s?"
msgstr "Tem certeza de que deseja excluir %(object_name)s: %(object)s ?"
#: templates/generic_confirm.html:42
#, python-format
msgid "Are you sure you wish to delete: %(object)s?"
msgstr "Tem certeza de que deseja excluir: %(object)s ?"
#: templates/generic_confirm.html:50
msgid "Yes"
msgstr "Sim"
#: templates/generic_confirm.html:54
msgid "No"
msgstr "Não"
#: templates/generic_form_instance.html:37
#: templates/generic_form_subtemplate.html:52
msgid "required"
msgstr "exigido"
#: templates/generic_form_subtemplate.html:76
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Save"
msgstr "Salvar"
#: templates/generic_form_subtemplate.html:76
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Submit"
msgstr "Submeter"
#: templates/generic_list.html:6 templates/generic_list_horizontal.html:6
#, python-format
msgid "List of %(stripped_title)s"
msgstr "Lista de %(stripped_title)s "
#: templates/generic_list_horizontal_subtemplate.html:23
#: templates/generic_list_subtemplate.html:24
#, python-format
msgid ""
"List of %(title)s (%(start)s - %(end)s out of %(total)s) (Page "
"%(page_number)s of %(total_pages)s)"
msgstr ""
"Lista de %(title)s (%(start)s - %(end)s de %(total)s) (Page %(page_number)s "
"of %(total_pages)s)"
#: templates/generic_list_horizontal_subtemplate.html:25
#: templates/generic_list_subtemplate.html:26
#, python-format
msgid "List of %(title)s (%(total)s)"
msgstr "Lista de %(title)s (%(total)s)"
#: templates/generic_list_subtemplate.html:72
msgid "Identifier"
msgstr "Identificador"
#: templates/generic_list_subtemplate.html:152
#, python-format
msgid "There are no %(stripped_title)s"
msgstr "Não há %(stripped_title)s "
#: templates/login.html:5
msgid "Login"
msgstr "Login"
#: templates/password_change_done.html:3 templates/password_change_form.html:3
#: templates/password_change_form.html:5
msgid "Password change"
msgstr "Alterar a senha"
#~ msgid "Cancel"
#~ msgstr "Cancelar"
Binary file not shown.
+314 -15
View File
@@ -1,33 +1,332 @@
# 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
# Translators:
# Sergey Glita <gsv70@mail.ru>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-30 16:51+0300\n"
"PO-Revision-Date: 2011-01-30 13:08\n"
"Last-Translator: <garison2004@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-11-22 19:21+0000\n"
"Last-Translator: gsv70 <gsv70@mail.ru>\n"
"Language-Team: Russian (http://www.transifex.net/projects/p/mayan-edms/team/ru/)\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.5\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Language: ru\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
#: views.py:6 templates/password_change_done.html:5
#: __init__.py:17
msgid "change password"
msgstr "Изменение пароля"
#: __init__.py:18
msgid "user details"
msgstr "сведения о пользователе"
#: __init__.py:19
msgid "edit details"
msgstr "изменение сведений"
#: __init__.py:23 __init__.py:29
msgid "about"
msgstr "инфо"
#: __init__.py:24
msgid "changelog"
msgstr "изменения"
#: __init__.py:25
msgid "license"
msgstr "лицензия"
#: forms.py:99
msgid "Selection"
msgstr "Выбор"
#: forms.py:131
msgid "Email"
msgstr "Email"
#: forms.py:142
msgid ""
"Please enter a correct email and password. Note that the password fields is "
"case-sensitive."
msgstr ""
"Пожалуйста, введите правильный адрес электронной почты и пароль с учетом "
"регистра."
#: forms.py:144
msgid "This account is inactive."
msgstr "Эта учетная запись неактивна."
#: literals.py:24
msgid "A5"
msgstr "A5"
#: literals.py:25
msgid "A4"
msgstr "A4"
#: literals.py:26
msgid "A3"
msgstr "A3"
#: literals.py:27
msgid "B5"
msgstr "B5"
#: literals.py:28
msgid "B4"
msgstr "B4"
#: literals.py:29
msgid "Letter"
msgstr "Letter"
#: literals.py:30
msgid "Legal"
msgstr "Legal"
#: literals.py:31
msgid "Ledger"
msgstr "Ledger"
#: literals.py:38
msgid "Portrait"
msgstr "Портрет"
#: literals.py:39
msgid "Landscape"
msgstr "Пейзаж"
#: utils.py:291
msgid "function found"
msgstr "функция найдена"
#: utils.py:293 utils.py:295
#, python-format
msgid "class found: %s"
msgstr "класс найден: %s."
#: views.py:24 templates/password_change_done.html:5
msgid "Your password has been successfully changed."
msgstr "Ваш пароль был успешно изменен."
msgstr "Ваш пароль был изменен."
#: views.py:41
msgid "No action selected."
msgstr "Никаких действий не выбрано."
#: views.py:45
msgid "Must select at least one item."
msgstr "Необходимо выбрать хотя бы один элемент."
#: views.py:86
#, python-format
msgid "%(selection)s added successfully added to %(right_list_title)s."
msgstr "%(selection)s успешно добавлен в %(right_list_title)s ."
#: views.py:89 views.py:106
#, python-format
msgid "Unable to add %(selection)s to %(right_list_title)s."
msgstr "Не удалось добавить %(selection)s до %(right_list_title)s ."
#: views.py:103
#, python-format
msgid "%(selection)s added successfully removed from %(right_list_title)s."
msgstr "%(selection)s успешно удален из %(right_list_title)s ."
#: views.py:121
msgid "Add"
msgstr "Добавить"
#: views.py:132
msgid "Remove"
msgstr "Удалить"
#: views.py:155
msgid "current user details"
msgstr "данные пользователя"
#: views.py:172
msgid "Current user's details updated."
msgstr "Данные пользователя обновлены."
#: views.py:181
msgid "edit current user details"
msgstr "редактировать данные пользователя"
#: views.py:207
msgid "Changelog"
msgstr "Изменения"
#: views.py:220
msgid "License"
msgstr "Лицензия"
#: widgets.py:58
msgid "None"
msgstr "Ни один"
#: conf/settings.py:15
msgid ""
"Temporary directory used site wide to store thumbnails, previews and "
"temporary files. If none is specified, one will be created using "
"tempfile.mkdtemp()"
msgstr ""
"Временный каталог, используемый сайтом для хранения миниатюр, превью и "
"временных файлов. Если он не указан, он будет создан с использованием "
"tempfile.mkdtemp ()"
#: conf/settings.py:65
msgid ""
"Controls the mechanism used to authenticated user. Options are: username, "
"email"
msgstr ""
"Управление механизмом, используемым для аутентификации пользователя. "
"Возможные варианты: имя пользователя, адрес электронной почты"
#: templates/403.html:3 templates/403.html.py:7
msgid "Insufficient permissions"
msgstr "Недостаточно прав"
#: templates/403.html:9
msgid "You don't have enough permissions for this operation."
msgstr "У вас недостаточно прав для этой операции."
#: templates/404.html:3 templates/404.html.py:7
msgid "Page not found"
msgstr "Страница не найдена"
#: templates/404.html:9
msgid "Sorry, but the requested page could not be found."
msgstr "Извините, но запрашиваемая страница не найдена."
#: templates/calculate_form_title.html:11
#, python-format
msgid "Details for %(object_name)s: %(object)s"
msgstr "Подробная информация для %(object_name)s : %(object)s"
#: templates/calculate_form_title.html:13
#, python-format
msgid "Details for: %(object)s"
msgstr "Подробности: %(object)s"
#: templates/calculate_form_title.html:18
#, python-format
msgid "Edit %(object_name)s:"
msgstr "Редактировать %(object_name)s :"
#: templates/calculate_form_title.html:20
msgid "Edit"
msgstr "Редактировать"
#: templates/calculate_form_title.html:24
#, python-format
msgid "Create new %(object_name)s"
msgstr "Создать %(object_name)s"
#: templates/calculate_form_title.html:26
msgid "Create"
msgstr "Создать"
#: templates/generic_assign_remove.html:3
#, python-format
msgid "Assign %(title)s %(object)s"
msgstr "Назначить %(title)s%(object)s"
#: templates/generic_confirm.html:3 templates/generic_confirm.html.py:18
msgid "Confirm"
msgstr "Подтверждать"
#: templates/generic_confirm.html:16
msgid "Confirm delete"
msgstr "Подтвердить удаление"
#: templates/generic_confirm.html:32
msgid "form icon"
msgstr "значок формы"
#: templates/generic_confirm.html:40
#, python-format
msgid "Are you sure you wish to delete %(object_name)s: %(object)s?"
msgstr "Вы действительно хотите удалить %(object_name)s: %(object)s?"
#: templates/generic_confirm.html:42
#, python-format
msgid "Are you sure you wish to delete: %(object)s?"
msgstr "Вы действительно хотите удалить: %(object)s?"
#: templates/generic_confirm.html:50
msgid "Yes"
msgstr "Да"
#: templates/generic_confirm.html:54
msgid "No"
msgstr "Нет"
#: templates/generic_form_instance.html:37
#: templates/generic_form_subtemplate.html:52
msgid "required"
msgstr "требуется"
#: templates/generic_form_subtemplate.html:76
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Save"
msgstr "Сохранить"
#: templates/generic_form_subtemplate.html:76
#: templates/generic_form_subtemplate.html:78
#: templates/generic_list_horizontal_subtemplate.html:51
#: templates/generic_list_horizontal_subtemplate.html:178
#: templates/generic_list_subtemplate.html:52
#: templates/generic_list_subtemplate.html:178
msgid "Submit"
msgstr "Выполнить"
#: templates/generic_list.html:6 templates/generic_list_horizontal.html:6
#, python-format
msgid "List of %(stripped_title)s"
msgstr "Список \"%(stripped_title)s\""
#: templates/generic_list_horizontal_subtemplate.html:23
#: templates/generic_list_subtemplate.html:24
#, python-format
msgid ""
"List of %(title)s (%(start)s - %(end)s out of %(total)s) (Page "
"%(page_number)s of %(total_pages)s)"
msgstr ""
"Список %(title)s (%(start)s - %(end)s из %(total)s) (Page %(page_number)s из"
" %(total_pages)s)"
#: templates/generic_list_horizontal_subtemplate.html:25
#: templates/generic_list_subtemplate.html:26
#, python-format
msgid "List of %(title)s (%(total)s)"
msgstr "Список %(title)s (%(total)s)"
#: templates/generic_list_subtemplate.html:72
msgid "Identifier"
msgstr "Идентификатор"
#: templates/generic_list_subtemplate.html:152
#, python-format
msgid "There are no %(stripped_title)s"
msgstr "Нет %(stripped_title)s"
#: templates/login.html:5
msgid "Login"
msgstr "Логин"
msgstr "Войти"
#: templates/password_change_done.html:3 templates/password_change_form.html:3
#: templates/password_change_form.html:5
msgid "Password change"
msgstr "Сменить пароль"
msgstr "Изменение пароля"
+5 -1
View File
@@ -22,7 +22,11 @@
<form action="" method="post" class="form login">{% csrf_token %}
{% if next %}
<input name="next" type="hidden" value="{{ next }}" />
{% endif %}
{% endif %}
{% if previous %}
<input name="previous" type="hidden" value="{{ previous }}" />
{% endif %}
<div style="float: left; margin-right: 10px;">
<img style="margin-top: 12px;" src="{{ STATIC_URL }}images/icons/{{ form_icon|default:'question.png' }}" alt="{% trans 'form icon' %}" />
+7
View File
@@ -3,6 +3,8 @@ import os
import re
import types
import tempfile
import string
import random
from django.utils.http import urlquote as django_urlquote
from django.utils.http import urlencode as django_urlencode
@@ -358,8 +360,13 @@ def validate_path(path):
return True
def encapsulate(function):
# Workaround Django ticket 15791
# Changeset 16045
# http://stackoverflow.com/questions/6861601/cannot-resolve-callable-context-variable/6955045#6955045
return lambda: function
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
+31 -42
View File
@@ -4,8 +4,6 @@ import hashlib
from common.conf.settings import TEMPORARY_DIRECTORY
from converter.conf.settings import UNOCONV_PATH
from converter.exceptions import OfficeConversionError
from converter.literals import DEFAULT_PAGE_NUMBER, \
DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, DEFAULT_FILE_FORMAT
@@ -16,28 +14,12 @@ from converter.literals import TRANSFORMATION_RESIZE, \
from converter.literals import DIMENSION_SEPARATOR
from converter.literals import FILE_FORMATS
from converter.utils import cleanup
from converter.runtime import office_converter
from converter.exceptions import OfficeConversionError
HASH_FUNCTION = lambda x: hashlib.sha256(x).hexdigest()
CONVERTER_OFFICE_FILE_EXTENSIONS = [
u'ods', u'docx', u'doc'
]
def execute_unoconv(input_filepath, arguments=''):
"""
Executes the program unoconv using subprocess's Popen
"""
command = []
command.append(UNOCONV_PATH)
command.extend(unicode(arguments).split())
command.append(input_filepath)
proc = subprocess.Popen(command, close_fds=True, stderr=subprocess.PIPE)
return_code = proc.wait()
if return_code != 0:
raise OfficeConversionError(proc.stderr.readline())
def cache_cleanup(input_filepath, *args, **kwargs):
try:
os.remove(create_image_cache_filename(input_filepath, *args, **kwargs))
@@ -53,22 +35,16 @@ def create_image_cache_filename(input_filepath, *args, **kwargs):
return None
def convert_office_document(input_filepath):
if os.path.exists(UNOCONV_PATH):
execute_unoconv(input_filepath, arguments='-f pdf')
return input_filepath + u'.pdf'
return None
def convert(input_filepath, output_filepath=None, cleanup_files=False, *args, **kwargs):
def convert(input_filepath, output_filepath=None, cleanup_files=False, mimetype=None, *args, **kwargs):
size = kwargs.get('size')
file_format = kwargs.get('file_format', DEFAULT_FILE_FORMAT)
zoom = kwargs.get('zoom', DEFAULT_ZOOM_LEVEL)
rotation = kwargs.get('rotation', DEFAULT_ROTATION)
page = kwargs.get('page', DEFAULT_PAGE_NUMBER)
transformations = kwargs.get('transformations', [])
unoconv_output = None
if transformations is None:
transformations = []
if output_filepath is None:
output_filepath = create_image_cache_filename(input_filepath, *args, **kwargs)
@@ -76,12 +52,18 @@ def convert(input_filepath, output_filepath=None, cleanup_files=False, *args, **
if os.path.exists(output_filepath):
return output_filepath
path, extension = os.path.splitext(input_filepath)
if extension[1:].lower() in CONVERTER_OFFICE_FILE_EXTENSIONS:
result = convert_office_document(input_filepath)
if result:
unoconv_output = result
input_filepath = result
if office_converter:
try:
office_converter.convert(input_filepath, mimetype=mimetype)
if office_converter.exists:
input_filepath = office_converter.output_filepath
mimetype = 'application/pdf'
else:
# Recycle the already detected mimetype
mimetype = office_converter.mimetype
except OfficeConversionError:
raise UnknownFileFormat('office converter exception')
if size:
transformations.append(
@@ -108,20 +90,27 @@ def convert(input_filepath, output_filepath=None, cleanup_files=False, *args, **
)
try:
backend.convert_file(input_filepath=input_filepath, output_filepath=output_filepath, transformations=transformations, page=page, file_format=file_format)
backend.convert_file(input_filepath=input_filepath, output_filepath=output_filepath, transformations=transformations, page=page, file_format=file_format, mimetype=mimetype)
finally:
if cleanup_files:
cleanup(input_filepath)
if unoconv_output:
cleanup(unoconv_output)
return output_filepath
def get_page_count(input_filepath):
if office_converter:
try:
office_converter.convert(input_filepath)
if office_converter.exists:
input_filepath = office_converter.output_filepath
except OfficeConversionError:
raise UnknownFileFormat('office converter exception')
return backend.get_page_count(input_filepath)
'''
def get_document_dimensions(document, *args, **kwargs):
document_filepath = create_image_cache_filename(document.checksum, *args, **kwargs)
if os.path.exists(document_filepath):
@@ -129,7 +118,7 @@ def get_document_dimensions(document, *args, **kwargs):
return [int(dimension) for dimension in backend.identify_file(unicode(document_filepath), options).split()]
else:
return [0, 0]
'''
def get_available_transformations_choices():
result = []
@@ -29,7 +29,7 @@ class ConverterClass(ConverterBase):
raise IdentifyError(proc.stderr.readline())
return proc.stdout.read()
def convert_file(self, input_filepath, output_filepath, transformations=None, page=DEFAULT_PAGE_NUMBER, file_format=DEFAULT_FILE_FORMAT):
def convert_file(self, input_filepath, output_filepath, transformations=None, page=DEFAULT_PAGE_NUMBER, file_format=DEFAULT_FILE_FORMAT, **kwargs):
arguments = []
try:
+1 -1
View File
@@ -29,7 +29,7 @@ class ConverterClass(ConverterBase):
raise IdentifyError(proc.stderr.readline())
return proc.stdout.read()
def convert_file(self, input_filepath, output_filepath, transformations=None, page=DEFAULT_PAGE_NUMBER, file_format=DEFAULT_FILE_FORMAT):
def convert_file(self, input_filepath, output_filepath, transformations=None, page=DEFAULT_PAGE_NUMBER, file_format=DEFAULT_FILE_FORMAT, **kwargs):
arguments = []
try:
if transformations:
+7 -4
View File
@@ -25,7 +25,7 @@ class ConverterClass(ConverterBase):
def get_page_count(self, input_filepath):
page_count = 1
mimetype, encoding = get_mimetype(input_filepath)
mimetype, encoding = get_mimetype(open(input_filepath, 'rb'), input_filepath, mimetype_only=True)
if mimetype == 'application/pdf':
# If file is a PDF open it with slate to determine the page
# count
@@ -48,9 +48,12 @@ class ConverterClass(ConverterBase):
return page_count
def convert_file(self, input_filepath, output_filepath, transformations=None, page=DEFAULT_PAGE_NUMBER, file_format=DEFAULT_FILE_FORMAT):
def convert_file(self, input_filepath, output_filepath, transformations=None, page=DEFAULT_PAGE_NUMBER, file_format=DEFAULT_FILE_FORMAT, **kwargs):
tmpfile = None
mimetype, encoding = get_mimetype(input_filepath)
mimetype = kwargs.get('mimetype', None)
if not mimetype:
mimetype, encoding = get_mimetype(open(input_filepath, 'rb'), input_filepath, mimetype_only=True)
if mimetype == 'application/pdf' and USE_GHOSTSCRIPT:
# If file is a PDF open it with ghostscript and convert it to
# TIFF
@@ -64,7 +67,7 @@ class ConverterClass(ConverterBase):
'gs', '-q', '-dQUIET', '-dSAFER', '-dBATCH',
'-dNOPAUSE', '-dNOPROMPT',
first_page_tmpl, last_page_tmpl,
'-sDEVICE=jpeg', '-dJPEGQ=75',
'-sDEVICE=jpeg', '-dJPEGQ=95',
'-r150', output_file_tmpl,
input_file_tmpl,
'-c "60000000 setvmthreshold"', # use 30MB
+5 -2
View File
@@ -1,4 +1,5 @@
"""Configuration options for the converter app"""
'''Configuration options for the converter app'''
from django.utils.translation import ugettext_lazy as _
from smart_settings.api import register_settings
@@ -12,7 +13,9 @@ register_settings(
{'name': u'GM_PATH', 'global_name': u'CONVERTER_GM_PATH', 'default': u'/usr/bin/gm', 'description': _(u'File path to graphicsmagick\'s program.'), 'exists': True},
{'name': u'GM_SETTINGS', 'global_name': u'CONVERTER_GM_SETTINGS', 'default': u''},
{'name': u'GRAPHICS_BACKEND', 'global_name': u'CONVERTER_GRAPHICS_BACKEND', 'default': u'converter.backends.python', 'description': _(u'Graphics conversion backend to use. Options are: converter.backends.imagemagick, converter.backends.graphicsmagick and converter.backends.python.')},
{'name': u'UNOCONV_PATH', 'global_name': u'CONVERTER_UNOCONV_PATH', 'default': u'/usr/bin/unoconv', 'exists': True},
{'name': u'UNOCONV_PATH', 'global_name': u'CONVERTER_UNOCONV_PATH', 'default': u'/usr/bin/unoconv', 'exists': True, 'description': _(u'Path to the unoconv program.')},
{'name': u'UNOCONV_USE_PIPE', 'global_name': u'CONVERTER_UNOCONV_USE_PIPE', 'default': True, 'description': _(u'Use alternate method of connection to LibreOffice using a pipe, it is slower but less prone to segmentation faults.')},
#{'name': u'OCR_OPTIONS', 'global_name': u'CONVERTER_OCR_OPTIONS', 'default': u'-colorspace Gray -depth 8 -resample 200x200'},
#{'name': u'HIGH_QUALITY_OPTIONS', 'global_name': u'CONVERTER_HIGH_QUALITY_OPTIONS', 'default': u'-density 400'},
#{'name': u'PRINT_QUALITY_OPTIONS', 'global_name': u'CONVERTER_PRINT_QUALITY_OPTIONS', 'default': u'-density 500'},
+4
View File
@@ -29,3 +29,7 @@ class UnkownConvertError(ConvertError):
class OfficeConversionError(ConvertError):
pass
class OfficeBackendError(OfficeConversionError):
pass
+1
View File
@@ -5,6 +5,7 @@ DEFAULT_ZOOM_LEVEL = 100
DEFAULT_ROTATION = 0
DEFAULT_PAGE_NUMBER = 1
DEFAULT_FILE_FORMAT = u'jpeg'
DEFAULT_FILE_FORMAT_MIMETYPE = u'image/jpeg'
DIMENSION_SEPARATOR = u'x'
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
+118
View File
@@ -0,0 +1,118 @@
import os
import subprocess
import logging
from mimetype.api import get_mimetype
from common.conf.settings import TEMPORARY_DIRECTORY
from common.utils import id_generator
from converter.conf.settings import UNOCONV_PATH, UNOCONV_USE_PIPE
from converter.exceptions import (OfficeConversionError,
OfficeBackendError, UnknownFileFormat)
CACHED_FILE_SUFFIX = u'_office_converter'
CONVERTER_OFFICE_FILE_MIMETYPES = [
u'application/msword',
u'application/mswrite',
u'application/mspowerpoint',
u'application/msexcel',
u'application/vnd.ms-excel',
u'application/vnd.ms-powerpoint',
u'application/vnd.oasis.opendocument.presentation',
u'application/vnd.oasis.opendocument.text',
u'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
u'application/vnd.oasis.opendocument.spreadsheet',
u'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
u'application/vnd.oasis.opendocument.graphics',
u'application/vnd.ms-office',
u'text/plain',
u'text/rtf',
]
logger = logging.getLogger(__name__)
class OfficeConverter(object):
def __init__(self):
self.backend_class = OfficeConverterBackendUnoconv
self.backend = self.backend_class()
self.exists = False
self.mimetype = None
self.encoding = None
def mimetypes(self):
return CONVERTER_OFFICE_FILE_MIMETYPES
def convert(self, input_filepath, mimetype=None):
self.exists = False
self.mimetype = None
self.encoding = None
self.input_filepath = input_filepath
# Make sure file is of a known office format
if mimetype:
self.mimetype = mimetype
else:
self.mimetype, self.encoding = get_mimetype(open(self.input_filepath), self.input_filepath, mimetype_only=True)
if self.mimetype in CONVERTER_OFFICE_FILE_MIMETYPES:
# Cache results of conversion
self.output_filepath = os.path.join(TEMPORARY_DIRECTORY, u''.join([self.input_filepath, CACHED_FILE_SUFFIX]))
self.exists = os.path.exists(self.output_filepath)
if not self.exists:
try:
self.backend.convert(self.input_filepath, self.output_filepath)
self.exists = True
except OfficeBackendError, msg:
# convert exception so that at least the mime type icon is displayed
raise UnknownFileFormat(msg)
def __unicode__(self):
return getattr(self, 'output_filepath', None)
def __str__(self):
return str(self.__unicode__())
class OfficeConverterBackendUnoconv(object):
def __init__(self):
self.unoconv_path = UNOCONV_PATH if UNOCONV_PATH else u'/usr/bin/unoconv'
if not os.path.exists(self.unoconv_path):
raise OfficeBackendError('cannot find unoconv executable')
def convert(self, input_filepath, output_filepath):
'''
Executes the program unoconv using subprocess's Popen
'''
self.input_filepath = input_filepath
self.output_filepath = output_filepath
command = []
command.append(self.unoconv_path)
if UNOCONV_USE_PIPE:
command.append(u'--pipe')
command.append(u'mayan-%s' % id_generator())
command.append(u'--format')
command.append(u'pdf')
command.append(u'--output')
command.append(self.output_filepath)
command.append(self.input_filepath)
try:
proc = subprocess.Popen(command, close_fds=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
return_code = proc.wait()
logger.debug('return_code: %s' % return_code)
readline = proc.stderr.readline()
logger.debug('stderr: %s' % readline)
if return_code != 0:
raise OfficeBackendError(readline)
except OSError, msg:
raise OfficeBackendError(msg)
except Exception, msg:
logger.error('Unhandled exception', exc_info=msg)
+8
View File
@@ -0,0 +1,8 @@
from converter.office_converter import OfficeConverter
from converter.exceptions import OfficeBackendError
try:
office_converter = OfficeConverter()
except OfficeBackendError:
office_converter = None
+46
View File
@@ -0,0 +1,46 @@
from django.utils.translation import ugettext_lazy as _
from documents.models import Document
from navigation.api import register_links, register_top_menu, \
register_model_list_columns, register_multi_item_links, \
register_sidebar_template
from main.api import register_diagnostic, register_maintenance_links
from permissions.api import register_permission, set_namespace_title
from project_setup.api import register_setup
from hkp import Key as KeyServerKey
from django_gpg.api import Key
PERMISSION_DOCUMENT_VERIFY = {'namespace': 'django_gpg', 'name': 'document_verify', 'label': _(u'Verify document signatures')}
PERMISSION_KEY_VIEW = {'namespace': 'django_gpg', 'name': 'key_view', 'label': _(u'View keys')}
PERMISSION_KEY_DELETE = {'namespace': 'django_gpg', 'name': 'key_delete', 'label': _(u'Delete keys')}
PERMISSION_KEYSERVER_QUERY = {'namespace': 'django_gpg', 'name': 'keyserver_query', 'label': _(u'Query keyservers')}
PERMISSION_KEY_RECEIVE = {'namespace': 'django_gpg', 'name': 'key_receive', 'label': _(u'Import key from keyservers')}
# Permission setup
set_namespace_title('django_gpg', _(u'Signatures'))
register_permission(PERMISSION_DOCUMENT_VERIFY)
register_permission(PERMISSION_KEY_VIEW)
register_permission(PERMISSION_KEY_DELETE)
register_permission(PERMISSION_KEYSERVER_QUERY)
register_permission(PERMISSION_KEY_RECEIVE)
# Setup views
private_keys = {'text': _(u'private keys'), 'view': 'key_private_list', 'args': 'object.pk', 'famfam': 'key', 'icon': 'key.png', 'permissions': [PERMISSION_KEY_VIEW]}
public_keys = {'text': _(u'public keys'), 'view': 'key_public_list', 'args': 'object.pk', 'famfam': 'key', 'icon': 'key.png', 'permissions': [PERMISSION_KEY_VIEW]}
key_delete = {'text': _(u'delete'), 'view': 'key_delete', 'args': ['object.fingerprint', 'object.type'], 'famfam': 'key_delete', 'permissions': [PERMISSION_KEY_DELETE]}
key_query = {'text': _(u'Query keyservers'), 'view': 'key_query', 'famfam': 'zoom', 'permissions': [PERMISSION_KEYSERVER_QUERY]}
key_receive = {'text': _(u'Import'), 'view': 'key_receive', 'args': 'object.keyid', 'famfam': 'key_add', 'keep_query': True, 'permissions': [PERMISSION_KEY_RECEIVE]}
# Document views
document_verify = {'text': _(u'signatures'), 'view': 'document_verify', 'args': 'object.pk', 'famfam': 'text_signature', 'permissions': [PERMISSION_DOCUMENT_VERIFY]}
register_links(Document, [document_verify], menu_name='form_header')
register_links(['key_delete', 'key_private_list', 'key_public_list', 'key_query'], [private_keys, public_keys, key_query], menu_name='sidebar')
register_links(Key, [key_delete])
register_links(KeyServerKey, [key_receive])
register_setup(private_keys)
register_setup(public_keys)
+331
View File
@@ -0,0 +1,331 @@
import types
from StringIO import StringIO
from pickle import dumps
import logging
from django.core.files.base import File
from django.utils.translation import ugettext_lazy as _
from django.utils.http import urlquote_plus
from hkp import KeyServer
import gnupg
from django_gpg.exceptions import (GPGVerificationError, GPGSigningError,
GPGDecryptionError, KeyDeleteError, KeyGenerationError,
KeyFetchingError, KeyDoesNotExist, KeyImportError)
logger = logging.getLogger(__name__)
KEY_TYPES = {
'pub': _(u'Public'),
'sec': _(u'Secret'),
}
KEY_CLASS_RSA = 'RSA'
KEY_CLASS_DSA = 'DSA'
KEY_CLASS_ELG = 'ELG-E'
KEY_PRIMARY_CLASSES = (
((KEY_CLASS_RSA), _(u'RSA')),
((KEY_CLASS_DSA), _(u'DSA')),
)
KEY_SECONDARY_CLASSES = (
((KEY_CLASS_RSA), _(u'RSA')),
((KEY_CLASS_ELG), _(u'Elgamal')),
)
KEYSERVER_DEFAULT_PORT = 11371
SIGNATURE_STATE_BAD = 'signature bad'
SIGNATURE_STATE_NONE = None
SIGNATURE_STATE_ERROR = 'signature error'
SIGNATURE_STATE_NO_PUBLIC_KEY = 'no public key'
SIGNATURE_STATE_GOOD = 'signature good'
SIGNATURE_STATE_VALID = 'signature valid'
SIGNATURE_STATES = {
SIGNATURE_STATE_BAD: {
'text': _(u'Bad signature.'),
'icon': 'cross.png'
},
SIGNATURE_STATE_NONE: {
'text': _(u'Document not signed or invalid signature.'),
'icon': 'cross.png'
},
SIGNATURE_STATE_ERROR: {
'text': _(u'Signature error.'),
'icon': 'cross.png'
},
SIGNATURE_STATE_NO_PUBLIC_KEY: {
'text': _(u'Document is signed but no public key is available for verification.'),
'icon': 'user_silhouette.png'
},
SIGNATURE_STATE_GOOD: {
'text': _(u'Document is signed, and signature is good.'),
'icon': 'document_signature.png'
},
SIGNATURE_STATE_VALID: {
'text': _(u'Document is signed with a valid signature.'),
'icon': 'document_signature.png'
},
}
class Key(object):
@staticmethod
def get_key_id(fingerprint):
return fingerprint[-16:]
@classmethod
def get_all(cls, gpg, secret=False, exclude=None):
result = []
keys = gpg.gpg.list_keys(secret=secret)
if exclude:
excluded_id = exclude.key_id
else:
excluded_id = u''
for key in keys:
if not key['keyid'] in excluded_id:
key_instance = Key(
fingerprint=key['fingerprint'],
uids=key['uids'],
type=key['type'],
data=gpg.gpg.export_keys([key['keyid']], secret=secret)
)
result.append(key_instance)
return result
@classmethod
def get(cls, gpg, key_id, secret=False, search_keyservers=False):
if len(key_id) > 16:
# key_id is a fingerprint
key_id = Key.get_key_id(key_id)
keys = gpg.gpg.list_keys(secret=secret)
key = next((key for key in keys if key['keyid'] == key_id), None)
if not key:
if search_keyservers and secret==False:
try:
gpg.receive_key(key_id)
return Key(gpg, key_id)
except KeyFetchingError:
raise KeyDoesNotExist
else:
raise KeyDoesNotExist
key_instance = Key(
fingerprint=key['fingerprint'],
uids=key['uids'],
type=key['type'],
data=gpg.gpg.export_keys([key['keyid']], secret=secret)
)
return key_instance
def __init__(self, fingerprint, uids, type, data):
self.fingerprint = fingerprint
self.uids = uids
self.type = type
self.data = data
@property
def key_id(self):
return Key.get_key_id(self.fingerprint)
@property
def user_ids(self):
return u', '.join(self.uids)
def __str__(self):
return '%s "%s" (%s)' % (self.key_id, self.user_ids, KEY_TYPES.get(self.type, _(u'unknown')))
def __unicode__(self):
return unicode(self.__str__())
def __repr__(self):
return self.__unicode__()
class GPG(object):
def __init__(self, binary_path=None, home=None, keyring=None, keyservers=None):
kwargs = {}
if binary_path:
kwargs['gpgbinary'] = binary_path
if home:
kwargs['gnupghome'] = home
if keyring:
kwargs['keyring'] = keyring
self.keyservers = keyservers
self.gpg = gnupg.GPG(**kwargs)
def verify_w_retry(self, file_input):
if isinstance(file_input, types.StringTypes):
input_descriptor = open(file_input, 'rb')
elif isinstance(file_input, types.FileType) or isinstance(file_input, File):
input_descriptor = file_input
elif issubclass(file_input.__class__, StringIO):
input_descriptor = file_input
else:
raise ValueError('Invalid file_input argument type')
try:
verify = self.verify_file(input_descriptor)
if verify.status == 'no public key':
# Try to fetch the public key from the keyservers
try:
self.receive_key(verify.key_id)
return self.verify_w_retry(file_input)
except KeyFetchingError:
return verify
else:
return verify
except IOError:
return False
def verify_file(self, file_input):
"""
Verify the signature of a file.
"""
if isinstance(file_input, types.StringTypes):
descriptor = open(file_input, 'rb')
elif isinstance(file_input, types.FileType) or isinstance(file_input, File) or isinstance(file_input, StringIO):
descriptor = file_input
else:
raise ValueError('Invalid file_input argument type')
verify = self.gpg.verify_file(descriptor)
descriptor.close()
if verify:
return verify
#elif getattr(verify, 'status', None) == 'no public key':
# # Exception to the rule, to be able to query the keyservers
# return verify
else:
raise GPGVerificationError()
def verify(self, data):
# TODO: try to merge with verify_file
verify = self.gpg.verify(data)
if verify:
return verify
else:
raise GPGVerificationError(verify.status)
def sign_file(self, file_input, key=None, destination=None, key_id=None, passphrase=None, clearsign=False):
"""
Signs a filename, storing the signature and the original file
in the destination filename provided (the destination file is
overrided if it already exists), if no destination file name is
provided the signature is returned.
"""
kwargs = {}
kwargs['clearsign'] = clearsign
if key_id:
kwargs['keyid'] = key_id
if key:
kwargs['keyid'] = key.key_id
if passphrase:
kwargs['passphrase'] = passphrase
if isinstance(file_input, types.StringTypes):
input_descriptor = open(file_input, 'rb')
elif isinstance(file_input, types.FileType) or isinstance(file_input, File):
input_descriptor = file_input
elif issubclass(file_input.__class__, StringIO):
input_descriptor = file_input
else:
raise ValueError('Invalid file_input argument type')
if destination:
output_descriptor = open(destination, 'wb')
signed_data = self.gpg.sign_file(input_descriptor, **kwargs)
if not signed_data.fingerprint:
raise GPGSigningError('Unable to sign file')
if destination:
output_descriptor.write(signed_data.data)
input_descriptor.close()
if destination:
output_descriptor.close()
if not destination:
return signed_data
def decrypt_file(self, file_input):
if isinstance(file_input, types.StringTypes):
input_descriptor = open(file_input, 'rb')
elif isinstance(file_input, types.FileType) or isinstance(file_input, File) or isinstance(file_input, StringIO):
input_descriptor = file_input
else:
raise ValueError('Invalid file_input argument type')
result = self.gpg.decrypt_file(input_descriptor)
input_descriptor.close()
if not result.status:
raise GPGDecryptionError('Unable to decrypt file')
return result
def create_key(self, *args, **kwargs):
if kwargs.get('passphrase') == u'':
kwargs.pop('passphrase')
input_data = self.gpg.gen_key_input(**kwargs)
key = self.gpg.gen_key(input_data)
if not key:
raise KeyGenerationError('Unable to generate key')
return Key.get(self, key.fingerprint)
def delete_key(self, key):
status = self.gpg.delete_keys(key.fingerprint, key.type == 'sec').status
if status == 'Must delete secret key first':
self.delete_key(Key.get(self, key.fingerprint, secret=True))
self.delete_key(key)
elif status != 'ok':
raise KeyDeleteError('Unable to delete key')
def receive_key(self, key_id):
for keyserver in self.keyservers:
import_result = self.gpg.recv_keys(keyserver, key_id)
if import_result:
return Key.get(self, import_result.fingerprints[0], secret=False)
raise KeyFetchingError
def query(self, term):
results = {}
for keyserver in self.keyservers:
url = u'http://%s' % keyserver
server = KeyServer(url)
try:
key_list = server.search(term)
for key in key_list:
results[key.keyid] = key
except:
pass
return results.values()
def import_key(self, key_data):
import_result = self.gpg.import_keys(key_data)
logger.debug('import_result: %s' % import_result)
if import_result:
return Key.get(self, import_result.fingerprints[0], secret=False)
raise KeyImportError
+15
View File
@@ -0,0 +1,15 @@
'''
Configuration options for the django_gpg app
'''
from django.utils.translation import ugettext_lazy as _
from smart_settings.api import register_settings
register_settings(
namespace=u'django_gpg',
module=u'django_gpg.conf.settings',
settings=[
{'name': u'KEYSERVERS', 'global_name': u'SIGNATURES_KEYSERVERS', 'default': ['pool.sks-keyservers.net'], 'description': _(u'List of keyservers to be queried for unknown keys.')},
]
)
+34
View File
@@ -0,0 +1,34 @@
class GPGException(Exception):
pass
class GPGVerificationError(GPGException):
pass
class GPGSigningError(GPGException):
pass
class GPGDecryptionError(GPGException):
pass
class KeyDeleteError(GPGException):
pass
class KeyGenerationError(GPGException):
pass
class KeyFetchingError(GPGException):
pass
class KeyDoesNotExist(GPGException):
pass
class KeyImportError(GPGException):
pass
+13
View File
@@ -0,0 +1,13 @@
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.conf import settings
class KeySearchForm(forms.Form):
term = forms.CharField(
label=_(u'Term'),
help_text=_(u'Name, e-mail, key ID or key fingerprint to look for.')
)
@@ -0,0 +1,253 @@
# 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-12-05 13:40-0400\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"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: __init__.py:14
msgid "Verify document signatures"
msgstr ""
#: __init__.py:15
msgid "View keys"
msgstr ""
#: __init__.py:16
msgid "Delete keys"
msgstr ""
#: __init__.py:17 __init__.py:32
msgid "Query keyservers"
msgstr ""
#: __init__.py:18
msgid "Import key from keyservers"
msgstr ""
#: __init__.py:21
msgid "Signatures"
msgstr ""
#: __init__.py:29 views.py:65
msgid "private keys"
msgstr ""
#: __init__.py:30 views.py:68
msgid "public keys"
msgstr ""
#: __init__.py:31
msgid "delete"
msgstr ""
#: __init__.py:33
msgid "Import"
msgstr ""
#: __init__.py:36
msgid "signatures"
msgstr ""
#: api.py:20
msgid "Public"
msgstr ""
#: api.py:21
msgid "Secret"
msgstr ""
#: api.py:29 api.py:34
msgid "RSA"
msgstr ""
#: api.py:30
msgid "DSA"
msgstr ""
#: api.py:35
msgid "Elgamal"
msgstr ""
#: api.py:49
msgid "Bad signature."
msgstr ""
#: api.py:53
msgid "Document not signed or invalid signature."
msgstr ""
#: api.py:57
msgid "Signature error."
msgstr ""
#: api.py:61
msgid "Document is signed but no public key is available for verification."
msgstr ""
#: api.py:65
msgid "Document is signed, and signature is good."
msgstr ""
#: api.py:69
msgid "Document is signed with a valid signature."
msgstr ""
#: api.py:142
msgid "unknown"
msgstr ""
#: forms.py:11
msgid "Term"
msgstr ""
#: forms.py:12
msgid "Name, e-mail, key ID or key fingerprint to look for."
msgstr ""
#: views.py:43
#, python-format
msgid "Key: %s, imported successfully."
msgstr ""
#: views.py:46
#, python-format
msgid "Unable to import key id: %s"
msgstr ""
#: views.py:50
msgid "Import key"
msgstr ""
#: views.py:51
#, python-format
msgid "Are you sure you wish to import key id: %s?"
msgstr ""
#: views.py:76
msgid "Key ID"
msgstr ""
#: views.py:80
msgid "Owner"
msgstr ""
#: views.py:100
#, python-format
msgid "Key: %s, deleted successfully."
msgstr ""
#: views.py:107
msgid "Delete key"
msgstr ""
#: views.py:109
#, python-format
msgid ""
"Are you sure you wish to delete key: %s? If you try to delete a public key "
"that is part of a public/private pair the private key will be deleted as "
"well."
msgstr ""
#: views.py:127
msgid "Query key server"
msgstr ""
#: views.py:140
msgid "results"
msgstr ""
#: views.py:145
msgid "ID"
msgstr ""
#: views.py:149
msgid "type"
msgstr ""
#: views.py:153
msgid "creation date"
msgstr ""
#: views.py:157
msgid "disabled"
msgstr ""
#: views.py:161
msgid "expiration date"
msgstr ""
#: views.py:165
msgid "expired"
msgstr ""
#: views.py:169
msgid "length"
msgstr ""
#: views.py:173
msgid "revoked"
msgstr ""
#: views.py:178
msgid "Identifies"
msgstr ""
#: views.py:205
#, python-format
msgid "Signature status: %(widget)s %(text)s"
msgstr ""
#: views.py:212
msgid "embedded"
msgstr ""
#: views.py:214
msgid "detached"
msgstr ""
#: views.py:219
#, python-format
msgid "Signature ID: %s"
msgstr ""
#: views.py:220
#, python-format
msgid "Signature type: %s"
msgstr ""
#: views.py:221
#, python-format
msgid "Key ID: %s"
msgstr ""
#: views.py:222
#, python-format
msgid "Timestamp: %s"
msgstr ""
#: views.py:223
#, python-format
msgid "Signee: %s"
msgstr ""
#: views.py:228
#, python-format
msgid "signature properties for: %s"
msgstr ""
#: conf/settings.py:13
msgid "List of keyservers to be queried for unknown keys."
msgstr ""
Binary file not shown.
@@ -0,0 +1,256 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Roberto Rosario <roberto.rosario.gonzalez@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-12-05 13:40-0400\n"
"PO-Revision-Date: 2011-12-05 17:52+0000\n"
"Last-Translator: rosarior <roberto.rosario.gonzalez@gmail.com>\n"
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/mayan-edms/team/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:14
msgid "Verify document signatures"
msgstr "Verificar las firmas de documentos"
#: __init__.py:15
msgid "View keys"
msgstr "Ver llaves"
#: __init__.py:16
msgid "Delete keys"
msgstr "Borrar llaves"
#: __init__.py:17 __init__.py:32
msgid "Query keyservers"
msgstr "Hacer búsquedas en servidores de llaves"
#: __init__.py:18
msgid "Import key from keyservers"
msgstr "Importar llaves de los servidores de llaves"
#: __init__.py:21
msgid "Signatures"
msgstr "Firmas"
#: __init__.py:29 views.py:65
msgid "private keys"
msgstr "llaves privadas"
#: __init__.py:30 views.py:68
msgid "public keys"
msgstr "llaves públicas"
#: __init__.py:31
msgid "delete"
msgstr "borrar"
#: __init__.py:33
msgid "Import"
msgstr "Importar"
#: __init__.py:36
msgid "signatures"
msgstr "firmas"
#: api.py:20
msgid "Public"
msgstr ""
#: api.py:21
msgid "Secret"
msgstr ""
#: api.py:29 api.py:34
msgid "RSA"
msgstr "RSA"
#: api.py:30
msgid "DSA"
msgstr "DSA"
#: api.py:35
msgid "Elgamal"
msgstr ""
#: api.py:49
msgid "Bad signature."
msgstr ""
#: api.py:53
msgid "Document not signed or invalid signature."
msgstr ""
#: api.py:57
msgid "Signature error."
msgstr ""
#: api.py:61
msgid "Document is signed but no public key is available for verification."
msgstr ""
#: api.py:65
msgid "Document is signed, and signature is good."
msgstr ""
#: api.py:69
msgid "Document is signed with a valid signature."
msgstr ""
#: api.py:142
msgid "unknown"
msgstr ""
#: forms.py:11
msgid "Term"
msgstr "Término"
#: forms.py:12
msgid "Name, e-mail, key ID or key fingerprint to look for."
msgstr ""
#: views.py:43
#, python-format
msgid "Key: %s, imported successfully."
msgstr ""
#: views.py:46
#, python-format
msgid "Unable to import key id: %s"
msgstr ""
#: views.py:50
msgid "Import key"
msgstr ""
#: views.py:51
#, python-format
msgid "Are you sure you wish to import key id: %s?"
msgstr "¿Esta seguro que desea importar la llave: %s?"
#: views.py:76
msgid "Key ID"
msgstr ""
#: views.py:80
msgid "Owner"
msgstr "Dueño"
#: views.py:100
#, python-format
msgid "Key: %s, deleted successfully."
msgstr "Llave: %s, borrada exitosamente."
#: views.py:107
msgid "Delete key"
msgstr "Borrar llave"
#: views.py:109
#, python-format
msgid ""
"Are you sure you wish to delete key: %s? If you try to delete a public key "
"that is part of a public/private pair the private key will be deleted as "
"well."
msgstr ""
#: views.py:127
msgid "Query key server"
msgstr ""
#: views.py:140
msgid "results"
msgstr "resultados"
#: views.py:145
msgid "ID"
msgstr ""
#: views.py:149
msgid "type"
msgstr "tipo"
#: views.py:153
msgid "creation date"
msgstr "fecha de creación"
#: views.py:157
msgid "disabled"
msgstr ""
#: views.py:161
msgid "expiration date"
msgstr ""
#: views.py:165
msgid "expired"
msgstr ""
#: views.py:169
msgid "length"
msgstr ""
#: views.py:173
msgid "revoked"
msgstr ""
#: views.py:178
msgid "Identifies"
msgstr ""
#: views.py:205
#, python-format
msgid "Signature status: %(widget)s %(text)s"
msgstr ""
#: views.py:212
msgid "embedded"
msgstr ""
#: views.py:214
msgid "detached"
msgstr ""
#: views.py:219
#, python-format
msgid "Signature ID: %s"
msgstr ""
#: views.py:220
#, python-format
msgid "Signature type: %s"
msgstr ""
#: views.py:221
#, python-format
msgid "Key ID: %s"
msgstr ""
#: views.py:222
#, python-format
msgid "Timestamp: %s"
msgstr ""
#: views.py:223
#, python-format
msgid "Signee: %s"
msgstr ""
#: views.py:228
#, python-format
msgid "signature properties for: %s"
msgstr ""
#: conf/settings.py:13
msgid "List of keyservers to be queried for unknown keys."
msgstr ""
Binary file not shown.
@@ -0,0 +1,255 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-12-05 13:40-0400\n"
"PO-Revision-Date: 2011-12-05 17:43+0000\n"
"Last-Translator: rosarior <roberto.rosario.gonzalez@gmail.com>\n"
"Language-Team: Portuguese (http://www.transifex.net/projects/p/mayan-edms/team/pt/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:14
msgid "Verify document signatures"
msgstr ""
#: __init__.py:15
msgid "View keys"
msgstr ""
#: __init__.py:16
msgid "Delete keys"
msgstr ""
#: __init__.py:17 __init__.py:32
msgid "Query keyservers"
msgstr ""
#: __init__.py:18
msgid "Import key from keyservers"
msgstr ""
#: __init__.py:21
msgid "Signatures"
msgstr ""
#: __init__.py:29 views.py:65
msgid "private keys"
msgstr ""
#: __init__.py:30 views.py:68
msgid "public keys"
msgstr ""
#: __init__.py:31
msgid "delete"
msgstr ""
#: __init__.py:33
msgid "Import"
msgstr ""
#: __init__.py:36
msgid "signatures"
msgstr ""
#: api.py:20
msgid "Public"
msgstr ""
#: api.py:21
msgid "Secret"
msgstr ""
#: api.py:29 api.py:34
msgid "RSA"
msgstr ""
#: api.py:30
msgid "DSA"
msgstr ""
#: api.py:35
msgid "Elgamal"
msgstr ""
#: api.py:49
msgid "Bad signature."
msgstr ""
#: api.py:53
msgid "Document not signed or invalid signature."
msgstr ""
#: api.py:57
msgid "Signature error."
msgstr ""
#: api.py:61
msgid "Document is signed but no public key is available for verification."
msgstr ""
#: api.py:65
msgid "Document is signed, and signature is good."
msgstr ""
#: api.py:69
msgid "Document is signed with a valid signature."
msgstr ""
#: api.py:142
msgid "unknown"
msgstr ""
#: forms.py:11
msgid "Term"
msgstr ""
#: forms.py:12
msgid "Name, e-mail, key ID or key fingerprint to look for."
msgstr ""
#: views.py:43
#, python-format
msgid "Key: %s, imported successfully."
msgstr ""
#: views.py:46
#, python-format
msgid "Unable to import key id: %s"
msgstr ""
#: views.py:50
msgid "Import key"
msgstr ""
#: views.py:51
#, python-format
msgid "Are you sure you wish to import key id: %s?"
msgstr ""
#: views.py:76
msgid "Key ID"
msgstr ""
#: views.py:80
msgid "Owner"
msgstr ""
#: views.py:100
#, python-format
msgid "Key: %s, deleted successfully."
msgstr ""
#: views.py:107
msgid "Delete key"
msgstr ""
#: views.py:109
#, python-format
msgid ""
"Are you sure you wish to delete key: %s? If you try to delete a public key "
"that is part of a public/private pair the private key will be deleted as "
"well."
msgstr ""
#: views.py:127
msgid "Query key server"
msgstr ""
#: views.py:140
msgid "results"
msgstr ""
#: views.py:145
msgid "ID"
msgstr ""
#: views.py:149
msgid "type"
msgstr ""
#: views.py:153
msgid "creation date"
msgstr ""
#: views.py:157
msgid "disabled"
msgstr ""
#: views.py:161
msgid "expiration date"
msgstr ""
#: views.py:165
msgid "expired"
msgstr ""
#: views.py:169
msgid "length"
msgstr ""
#: views.py:173
msgid "revoked"
msgstr ""
#: views.py:178
msgid "Identifies"
msgstr ""
#: views.py:205
#, python-format
msgid "Signature status: %(widget)s %(text)s"
msgstr ""
#: views.py:212
msgid "embedded"
msgstr ""
#: views.py:214
msgid "detached"
msgstr ""
#: views.py:219
#, python-format
msgid "Signature ID: %s"
msgstr ""
#: views.py:220
#, python-format
msgid "Signature type: %s"
msgstr ""
#: views.py:221
#, python-format
msgid "Key ID: %s"
msgstr ""
#: views.py:222
#, python-format
msgid "Timestamp: %s"
msgstr ""
#: views.py:223
#, python-format
msgid "Signee: %s"
msgstr ""
#: views.py:228
#, python-format
msgid "signature properties for: %s"
msgstr ""
#: conf/settings.py:13
msgid "List of keyservers to be queried for unknown keys."
msgstr ""
Binary file not shown.
@@ -0,0 +1,255 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-12-05 13:40-0400\n"
"PO-Revision-Date: 2011-12-05 17:43+0000\n"
"Last-Translator: rosarior <roberto.rosario.gonzalez@gmail.com>\n"
"Language-Team: Russian (http://www.transifex.net/projects/p/mayan-edms/team/ru/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ru\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
#: __init__.py:14
msgid "Verify document signatures"
msgstr ""
#: __init__.py:15
msgid "View keys"
msgstr ""
#: __init__.py:16
msgid "Delete keys"
msgstr ""
#: __init__.py:17 __init__.py:32
msgid "Query keyservers"
msgstr ""
#: __init__.py:18
msgid "Import key from keyservers"
msgstr ""
#: __init__.py:21
msgid "Signatures"
msgstr ""
#: __init__.py:29 views.py:65
msgid "private keys"
msgstr ""
#: __init__.py:30 views.py:68
msgid "public keys"
msgstr ""
#: __init__.py:31
msgid "delete"
msgstr ""
#: __init__.py:33
msgid "Import"
msgstr ""
#: __init__.py:36
msgid "signatures"
msgstr ""
#: api.py:20
msgid "Public"
msgstr ""
#: api.py:21
msgid "Secret"
msgstr ""
#: api.py:29 api.py:34
msgid "RSA"
msgstr ""
#: api.py:30
msgid "DSA"
msgstr ""
#: api.py:35
msgid "Elgamal"
msgstr ""
#: api.py:49
msgid "Bad signature."
msgstr ""
#: api.py:53
msgid "Document not signed or invalid signature."
msgstr ""
#: api.py:57
msgid "Signature error."
msgstr ""
#: api.py:61
msgid "Document is signed but no public key is available for verification."
msgstr ""
#: api.py:65
msgid "Document is signed, and signature is good."
msgstr ""
#: api.py:69
msgid "Document is signed with a valid signature."
msgstr ""
#: api.py:142
msgid "unknown"
msgstr ""
#: forms.py:11
msgid "Term"
msgstr ""
#: forms.py:12
msgid "Name, e-mail, key ID or key fingerprint to look for."
msgstr ""
#: views.py:43
#, python-format
msgid "Key: %s, imported successfully."
msgstr ""
#: views.py:46
#, python-format
msgid "Unable to import key id: %s"
msgstr ""
#: views.py:50
msgid "Import key"
msgstr ""
#: views.py:51
#, python-format
msgid "Are you sure you wish to import key id: %s?"
msgstr ""
#: views.py:76
msgid "Key ID"
msgstr ""
#: views.py:80
msgid "Owner"
msgstr ""
#: views.py:100
#, python-format
msgid "Key: %s, deleted successfully."
msgstr ""
#: views.py:107
msgid "Delete key"
msgstr ""
#: views.py:109
#, python-format
msgid ""
"Are you sure you wish to delete key: %s? If you try to delete a public key "
"that is part of a public/private pair the private key will be deleted as "
"well."
msgstr ""
#: views.py:127
msgid "Query key server"
msgstr ""
#: views.py:140
msgid "results"
msgstr ""
#: views.py:145
msgid "ID"
msgstr ""
#: views.py:149
msgid "type"
msgstr ""
#: views.py:153
msgid "creation date"
msgstr ""
#: views.py:157
msgid "disabled"
msgstr ""
#: views.py:161
msgid "expiration date"
msgstr ""
#: views.py:165
msgid "expired"
msgstr ""
#: views.py:169
msgid "length"
msgstr ""
#: views.py:173
msgid "revoked"
msgstr ""
#: views.py:178
msgid "Identifies"
msgstr ""
#: views.py:205
#, python-format
msgid "Signature status: %(widget)s %(text)s"
msgstr ""
#: views.py:212
msgid "embedded"
msgstr ""
#: views.py:214
msgid "detached"
msgstr ""
#: views.py:219
#, python-format
msgid "Signature ID: %s"
msgstr ""
#: views.py:220
#, python-format
msgid "Signature type: %s"
msgstr ""
#: views.py:221
#, python-format
msgid "Key ID: %s"
msgstr ""
#: views.py:222
#, python-format
msgid "Timestamp: %s"
msgstr ""
#: views.py:223
#, python-format
msgid "Signee: %s"
msgstr ""
#: views.py:228
#, python-format
msgid "signature properties for: %s"
msgstr ""
#: conf/settings.py:13
msgid "List of keyservers to be queried for unknown keys."
msgstr ""
+1
View File
@@ -0,0 +1 @@
+4
View File
@@ -0,0 +1,4 @@
from django_gpg.api import GPG
from django_gpg.conf.settings import KEYSERVERS
gpg = GPG(keyservers=KEYSERVERS)
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

+11
View File
@@ -0,0 +1,11 @@
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('django_gpg.views',
url(r'^delete/(?P<fingerprint>.+)/(?P<key_type>\w+)/$', 'key_delete', (), 'key_delete'),
url(r'^list/private/$', 'key_list', {'secret': True}, 'key_private_list'),
url(r'^list/public/$', 'key_list', {'secret': False}, 'key_public_list'),
url(r'^verify/(?P<document_pk>\d+)/$', 'document_verify', (), 'document_verify'),
url(r'^query/$', 'key_query', (), 'key_query'),
url(r'^receive/(?P<key_id>.+)/$', 'key_receive', (), 'key_receive'),
)
+232
View File
@@ -0,0 +1,232 @@
from datetime import datetime
import logging
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django.conf import settings
from django.template.defaultfilters import force_escape
from documents.models import Document, RecentDocument
from permissions.api import check_permissions
from common.utils import pretty_size, parse_range, urlquote, \
return_diff, encapsulate
from django_gpg.api import Key, SIGNATURE_STATES
from django_gpg.runtime import gpg
from django_gpg.exceptions import GPGVerificationError, KeyFetchingError
from django_gpg import (PERMISSION_DOCUMENT_VERIFY, PERMISSION_KEY_VIEW,
PERMISSION_KEY_DELETE, PERMISSION_KEYSERVER_QUERY,
PERMISSION_KEY_RECEIVE)
from django_gpg.forms import KeySearchForm
logger = logging.getLogger(__name__)
def key_receive(request, key_id):
check_permissions(request.user, [PERMISSION_KEY_RECEIVE])
post_action_redirect = None
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
next = request.POST.get('next', request.GET.get('next', post_action_redirect if post_action_redirect else request.META.get('HTTP_REFERER', '/')))
if request.method == 'POST':
try:
term = request.GET.get('term')
results = gpg.query(term)
keys_dict = dict([(key.keyid, key) for key in results])
key = gpg.import_key(keys_dict[key_id].key)
messages.success(request, _(u'Key: %s, imported successfully.') % key)
return HttpResponseRedirect(next)
except (KeyFetchingError, KeyError, TypeError):
messages.error(request, _(u'Unable to import key id: %s') % key_id)
return HttpResponseRedirect(previous)
return render_to_response('generic_confirm.html', {
'title': _(u'Import key'),
'message': _(u'Are you sure you wish to import key id: %s?') % key_id,
'form_icon': 'key_add.png',
'next': next,
'previous': previous,
'submit_method': 'GET',
}, context_instance=RequestContext(request))
def key_list(request, secret=True):
check_permissions(request.user, [PERMISSION_KEY_VIEW])
if secret:
object_list = Key.get_all(gpg, secret=True)
title = _(u'private keys')
else:
object_list = Key.get_all(gpg)
title = _(u'public keys')
return render_to_response('generic_list.html', {
'object_list': object_list,
'title': title,
'hide_object': True,
'extra_columns': [
{
'name': _(u'Key ID'),
'attribute': 'key_id',
},
{
'name': _(u'Owner'),
'attribute': encapsulate(lambda x: u', '.join(x.uids)),
},
]
}, context_instance=RequestContext(request))
def key_delete(request, fingerprint, key_type):
check_permissions(request.user, [PERMISSION_KEY_DELETE])
secret = key_type == 'sec'
key = Key.get(gpg, fingerprint, secret=secret)
post_action_redirect = None
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
next = request.POST.get('next', request.GET.get('next', post_action_redirect if post_action_redirect else request.META.get('HTTP_REFERER', '/')))
if request.method == 'POST':
try:
gpg.delete_key(key)
messages.success(request, _(u'Key: %s, deleted successfully.') % fingerprint)
return HttpResponseRedirect(next)
except Exception, msg:
messages.error(request, msg)
return HttpResponseRedirect(previous)
return render_to_response('generic_confirm.html', {
'title': _(u'Delete key'),
'delete_view': True,
'message': _(u'Are you sure you wish to delete key: %s? If you try to delete a public key that is part of a public/private pair the private key will be deleted as well.') % key,
'form_icon': 'key_delete.png',
'next': next,
'previous': previous,
}, context_instance=RequestContext(request))
def key_query(request):
check_permissions(request.user, [PERMISSION_KEYSERVER_QUERY])
subtemplates_list = []
term = request.GET.get('term')
form = KeySearchForm(initial={'term': term})
subtemplates_list.append(
{
'name': 'generic_form_subtemplate.html',
'context': {
'title': _(u'Query key server'),
'form': form,
'submit_method': 'GET',
},
}
)
if term:
results = gpg.query(term)
subtemplates_list.append(
{
'name': 'generic_list_subtemplate.html',
'context': {
'title': _(u'results'),
'object_list': results,
'hide_object': True,
'extra_columns': [
{
'name': _(u'ID'),
'attribute': 'keyid',
},
{
'name': _(u'type'),
'attribute': 'algo',
},
{
'name': _(u'creation date'),
'attribute': 'creation_date',
},
{
'name': _(u'disabled'),
'attribute': 'disabled',
},
{
'name': _(u'expiration date'),
'attribute': 'expiration_date',
},
{
'name': _(u'expired'),
'attribute': 'expired',
},
{
'name': _(u'length'),
'attribute': 'key_length',
},
{
'name': _(u'revoked'),
'attribute': 'revoked',
},
{
'name': _(u'Identifies'),
'attribute': encapsulate(lambda x: u', '.join([identity.uid for identity in x.identities])),
},
]
},
}
)
return render_to_response('generic_form.html', {
'subtemplates_list': subtemplates_list,
}, context_instance=RequestContext(request))
def document_verify(request, document_pk):
check_permissions(request.user, [PERMISSION_DOCUMENT_VERIFY])
document = get_object_or_404(Document, pk=document_pk)
RecentDocument.objects.add_document_for_user(request.user, document)
try:
signature = gpg.verify_w_retry(document.open(raw=True))
except GPGVerificationError:
signature = None
signature_state = SIGNATURE_STATES.get(getattr(signature, 'status', None))
widget = (u'<img style="vertical-align: middle;" src="%simages/icons/%s" />' % (settings.STATIC_URL, signature_state['icon']))
paragraphs = [
_(u'Signature status: %(widget)s %(text)s') % {
'widget': mark_safe(widget),
'text': signature_state['text']
},
]
if document.signature_state:
signature_type = _(u'embedded')
else:
signature_type = _(u'detached')
if signature:
paragraphs.extend(
[
_(u'Signature ID: %s') % signature.signature_id,
_(u'Signature type: %s') % signature_type,
_(u'Key ID: %s') % signature.key_id,
_(u'Timestamp: %s') % datetime.fromtimestamp(int(signature.sig_timestamp)),
_(u'Signee: %s') % force_escape(getattr(signature, 'username', u'')),
]
)
return render_to_response('generic_template.html', {
'title': _(u'signature properties for: %s') % document,
'object': document,
'document': document,
'paragraphs': paragraphs,
}, context_instance=RequestContext(request))
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-29 18:44-0400\n"
"POT-Creation-Date: 2011-11-22 11:26-0400\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"
@@ -1,20 +1,21 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-09-29 18:44-0400\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-09-30 04:34+0000\n"
"Last-Translator: rosarior <roberto.rosario.gonzalez@gmail.com>\n"
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/mayan-edms/team/es/)\n"
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/"
"mayan-edms/team/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:15
@@ -98,5 +99,3 @@ msgstr "Añadir comentario al documento: %s"
#, python-format
msgid "comments: %s"
msgstr "comentarios: %s"
@@ -1,21 +1,22 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# <dev.emerson@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-09-29 18:44-0400\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-09-30 21:14+0000\n"
"Last-Translator: emersonsoares <dev.emerson@gmail.com>\n"
"Language-Team: Portuguese (http://www.transifex.net/projects/p/mayan-edms/team/pt/)\n"
"Language-Team: Portuguese (http://www.transifex.net/projects/p/mayan-edms/"
"team/pt/)\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: pt\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:15
@@ -99,5 +100,3 @@ msgstr "Adicionar comentário ao documento: %s"
#, python-format
msgid "comments: %s"
msgstr "comentários: %s"
@@ -0,0 +1,103 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Sergey Glita <gsv70@mail.ru>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-11-19 20:58+0000\n"
"Last-Translator: gsv70 <gsv70@mail.ru>\n"
"Language-Team: Russian (http://www.transifex.net/projects/p/mayan-edms/team/"
"ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
#: __init__.py:15
msgid "Create new comments"
msgstr "Создать новые комментарии"
#: __init__.py:16
msgid "Delete comments"
msgstr "Удалить комментарии"
#: __init__.py:17
msgid "Edit comments"
msgstr "Редактировать комментарии"
#: __init__.py:18
msgid "View comments"
msgstr "Просмотр комментариев"
#: __init__.py:20
msgid "Comments"
msgstr "Комментарии"
#: __init__.py:26 __init__.py:27
msgid "delete"
msgstr "удалить"
#: __init__.py:28
msgid "add comment"
msgstr "добавить комментарий"
#: __init__.py:29 utils.py:14
msgid "comments"
msgstr "комментарии"
#: __init__.py:33
msgid "date"
msgstr "дата"
#: __init__.py:37
msgid "user"
msgstr "пользователь"
#: __init__.py:41
msgid "comment"
msgstr "комментарий"
#: views.py:27
msgid "Must provide at least one comment."
msgstr "Должен быть хотя бы один комментарий."
#: views.py:37
#, python-format
msgid "Comment \"%s\" deleted successfully."
msgstr "Комментарий \"%s\" удален."
#: views.py:39
#, python-format
msgid "Error deleting comment \"%(comment)s\": %(error)s"
msgstr "Ошибка при удалении комментариев \"%(comment)s\": %(error)s"
#: views.py:54
#, python-format
msgid "Are you sure you wish to delete the comment: %s?"
msgstr "Вы действительно хотите удалить комментарий %s?"
#: views.py:56
#, python-format
msgid "Are you sure you wish to delete the comments: %s?"
msgstr "Вы действительно хотите удалить комментарии %s?"
#: views.py:86
msgid "Comment added successfully."
msgstr "Комментарий добавлен."
#: views.py:93
#, python-format
msgid "Add comment to document: %s"
msgstr "Добавить комментарий на документ: %s"
#: views.py:109
#, python-format
msgid "comments: %s"
msgstr "комментарии: %s"
+2 -2
View File
@@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
from navigation.api import register_top_menu, register_sidebar_template, \
register_links
from permissions.api import register_permission, set_namespace_title
from main.api import register_maintenance
from main.api import register_maintenance_links
from documents.literals import PERMISSION_DOCUMENT_VIEW
from documents.models import Document
@@ -24,7 +24,7 @@ register_top_menu('indexes', link={'text': _('indexes'), 'famfam': 'folder_page'
rebuild_index_instances = {'text': _('rebuild indexes'), 'view': 'rebuild_index_instances', 'famfam': 'folder_page', 'permissions': [PERMISSION_DOCUMENT_INDEXING_REBUILD_INDEXES], 'description': _(u'Deletes and creates from scratch all the document indexes.')}
register_maintenance(rebuild_index_instances, namespace='document_indexing', title=_(u'Indexes'))
register_maintenance_links([rebuild_index_instances], namespace='document_indexing', title=_(u'Indexes'))
register_sidebar_template(['index_instance_list'], 'indexing_help.html')
+5 -4
View File
@@ -15,7 +15,7 @@ from document_indexing.filesystem import fs_create_index_directory, \
fs_create_document_link, fs_delete_document_link, \
fs_delete_index_directory, fs_delete_directory_recusive
from document_indexing.conf.settings import SLUGIFY_PATHS
from document_indexing.os_agnostic import assemble_document_filename
from document_indexing.os_specifics import assemble_suffixed_filename
if SLUGIFY_PATHS == False:
# Do not slugify path or filenames and extensions
@@ -127,13 +127,14 @@ def do_rebuild_all_indexes():
# Internal functions
def find_lowest_available_suffix(index_instance, document):
index_instance_documents = DocumentRenameCount.objects.filter(index_instance=index_instance).filter(document__file_extension=document.file_extension)
# TODO: verify extension's role in query
index_instance_documents = DocumentRenameCount.objects.filter(index_instance=index_instance)#.filter(document__file_extension=document.file_extension)
files_list = []
for index_instance_document in index_instance_documents:
files_list.append(assemble_document_filename(index_instance_document.document, index_instance_document.suffix))
files_list.append(assemble_suffixed_filename(index_instance_document.document.file.name, index_instance_document.suffix))
for suffix in xrange(MAX_SUFFIX_COUNT):
if assemble_document_filename(document, suffix) not in files_list:
if assemble_suffixed_filename(document.file.name, suffix) not in files_list:
return suffix
raise MaxSuffixCountReached(ugettext(u'Maximum suffix (%s) count reached.') % MAX_SUFFIX_COUNT)
+10 -13
View File
@@ -3,7 +3,8 @@ import os
from django.utils.translation import ugettext_lazy as _
from document_indexing.os_agnostic import assemble_document_filename
from document_indexing.os_specifics import (assemble_suffixed_filename,
assemble_path_from_list)
from document_indexing.conf.settings import FILESERVING_ENABLE
from document_indexing.conf.settings import FILESERVING_PATH
@@ -19,12 +20,12 @@ def get_instance_path(index_instance):
names.append(index_instance.value)
return os.sep.join(names)
return assemble_path_from_list(names)
def fs_create_index_directory(index_instance):
if FILESERVING_ENABLE:
target_directory = os.path.join(FILESERVING_PATH, get_instance_path(index_instance))
target_directory = assemble_path_from_list([FILESERVING_PATH, get_instance_path(index_instance)])
try:
os.mkdir(target_directory)
except OSError, exc:
@@ -36,9 +37,9 @@ def fs_create_index_directory(index_instance):
def fs_create_document_link(index_instance, document, suffix=0):
if FILESERVING_ENABLE:
name_part = assemble_document_filename(document, suffix)
filename = os.extsep.join([name_part, document.file_extension])
filepath = os.path.join(FILESERVING_PATH, get_instance_path(index_instance), filename)
filename = assemble_suffixed_filename(document.file.name, suffix)
filepath = assemble_path_from_list([FILESERVING_PATH, get_instance_path(index_instance), filename])
try:
os.symlink(document.file.path, filepath)
except OSError, exc:
@@ -56,12 +57,8 @@ def fs_create_document_link(index_instance, document, suffix=0):
def fs_delete_document_link(index_instance, document, suffix=0):
if FILESERVING_ENABLE:
name_part = document.file_filename
if suffix:
name_part = u'_'.join([name_part, unicode(suffix)])
filename = os.extsep.join([name_part, document.file_extension])
filepath = os.path.join(FILESERVING_PATH, get_instance_path(index_instance), filename)
filename = assemble_suffixed_filename(document.file.name, suffix)
filepath = assemble_path_from_list([FILESERVING_PATH, get_instance_path(index_instance), filename])
try:
os.unlink(filepath)
@@ -73,7 +70,7 @@ def fs_delete_document_link(index_instance, document, suffix=0):
def fs_delete_index_directory(index_instance):
if FILESERVING_ENABLE:
target_directory = os.path.join(FILESERVING_PATH, get_instance_path(index_instance))
target_directory = assemble_path_from_list([FILESERVING_PATH, get_instance_path(index_instance)])
try:
os.removedirs(target_directory)
except OSError, exc:
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-29 18:45-0400\n"
"POT-Creation-Date: 2011-11-22 11:26-0400\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"
@@ -1,20 +1,22 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
#
# Translators:
# Roberto Rosario <roberto.rosario.gonzalez@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: http://github.com/rosarior/mayan/issues\n"
"POT-Creation-Date: 2011-09-29 18:45-0400\n"
"PO-Revision-Date: 2011-09-30 05:09+0000\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-11-04 17:05+0000\n"
"Last-Translator: rosarior <roberto.rosario.gonzalez@gmail.com>\n"
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/mayan-edms/team/es/)\n"
"Language-Team: Spanish (Castilian) (http://www.transifex.net/projects/p/"
"mayan-edms/team/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:12
@@ -35,7 +37,7 @@ msgstr "lista de indices"
#: __init__.py:20
msgid "go up one level"
msgstr ""
msgstr "subir un nivel"
#: __init__.py:21 __init__.py:23 models.py:26
msgid "indexes"
@@ -176,7 +178,7 @@ msgstr "contenido del indice: %s"
#: views.py:60
msgid "items"
msgstr ""
msgstr "artículos"
#: views.py:82
msgid "Are you sure you wish to rebuild all indexes?"
@@ -185,8 +187,8 @@ msgstr "¿Está seguro que desea reconstruir todos los índices?"
#: views.py:83
msgid "On large databases this operation may take some time to execute."
msgstr ""
"En bases de datos de gran tamaño esta operación puede tardar algún tiempo en"
" ejecutarse."
"En bases de datos de gran tamaño esta operación puede tardar algún tiempo en "
"ejecutarse."
#: views.py:89
msgid "Index rebuild completed successfully."
@@ -200,7 +202,7 @@ msgstr "Error de reconstrucción de índices: %s"
#: views.py:109
#, python-format
msgid "indexes containing: %s"
msgstr ""
msgstr "índices que contienen: %s"
#: templates/indexing_help.html:3
msgid "What are indexes?"
@@ -210,5 +212,3 @@ msgstr "¿Que son los índices?"
msgid "Indexes group documents into a tree like hierarchical structure."
msgstr ""
"Los índices agrupan documentos en una estructura jerárquica tipo árbol. "
@@ -0,0 +1,213 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
# Renata Oliveira <renatabels@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-11-03 02:59+0000\n"
"Last-Translator: renataoliveira <renatabels@gmail.com>\n"
"Language-Team: Portuguese (http://www.transifex.net/projects/p/mayan-edms/"
"team/pt/)\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
#: __init__.py:12
msgid "View document indexes"
msgstr "Ver índices de documento"
#: __init__.py:13
msgid "Rebuild document indexes"
msgstr "Reconstruir índices de documento"
#: __init__.py:15
msgid "Indexing"
msgstr "Indexando"
#: __init__.py:19
msgid "index list"
msgstr "lista de índice"
#: __init__.py:20
msgid "go up one level"
msgstr "subir um nível"
#: __init__.py:21 __init__.py:23 models.py:26
msgid "indexes"
msgstr "índices"
#: __init__.py:25
msgid "rebuild indexes"
msgstr "reconstruir índices"
#: __init__.py:25
msgid "Deletes and creates from scratch all the document indexes."
msgstr "Exclui e criar a partir do zero todos os índices de documento."
#: __init__.py:27
msgid "Indexes"
msgstr "Índices"
#: api.py:83
msgid "root"
msgstr "raiz"
#: api.py:139
#, python-format
msgid "Maximum suffix (%s) count reached."
msgstr "Quantidade máxima do sufixo (%s) alcançada."
#: api.py:175
#, python-format
msgid ""
"Error in document indexing update expression: %(expression)s; %(exception)s"
msgstr ""
"Erro de atualização na expressão de indexação do documento: %(expression)s; "
"%(exception)s "
#: api.py:178
#, python-format
msgid ""
"Error updating document index, expression: %(expression)s; %(exception)s"
msgstr ""
"Erro de atualização de índice do documento, a expressão: %(expression)s ; "
"%(exception)s "
#: api.py:209
#, python-format
msgid "Unable to delete document indexing node; %s"
msgstr "Não é possível excluir o nó de indexação de documentos; %s"
#: filesystem.py:34
#, python-format
msgid "Unable to create indexing directory; %s"
msgstr "Não é possível criar o diretório de indexação; %s"
#: filesystem.py:52
#, python-format
msgid ""
"Unable to create symbolic link, file exists and could not be deleted: "
"%(filepath)s; %(exc)s"
msgstr ""
"Não é possível criar o link simbólico, o arquivo existe e não pode ser "
"excluído: %(filepath)s; %(exc)s "
#: filesystem.py:54
#, python-format
msgid "Unable to create symbolic link: %(filepath)s; %(exc)s"
msgstr "Não é possível criar o link simbólico: %(filepath)s; %(exc)s "
#: filesystem.py:71
#, python-format
msgid "Unable to delete document symbolic link; %s"
msgstr "Não é possível excluir o link simbólico do documento; %s"
#: filesystem.py:83
#, python-format
msgid "Unable to delete indexing directory; %s"
msgstr "Não é possível excluir o diretório de indexação; %s"
#: models.py:11
#, python-format
msgid "Available functions: %s"
msgstr "Funções disponíveis: %s "
#: models.py:16
msgid "indexing expression"
msgstr "expressão de indexação"
#: models.py:16
msgid "Enter a python string expression to be evaluated."
msgstr "Digite uma expressão python para ser avaliada."
#: models.py:18
msgid "enabled"
msgstr "habilitado"
#: models.py:19
msgid "link documents"
msgstr "ligar documentos"
#: models.py:25 models.py:31 views.py:56
msgid "index"
msgstr "índice"
#: models.py:32
msgid "value"
msgstr "valor"
#: models.py:33
msgid "documents"
msgstr "documentos"
#: models.py:46 models.py:51
msgid "index instance"
msgstr "exemplo de índice"
#: models.py:47
msgid "indexes instances"
msgstr "exemplos de índices"
#: models.py:52
msgid "document"
msgstr "documento"
#: models.py:59
msgid "document rename count"
msgstr "contagem de renomeação do documento"
#: models.py:60
msgid "documents rename count"
msgstr "contagem de renomeação dos documentos"
#: utils.py:19
msgid "document indexes"
msgstr "índices de documento"
#: views.py:38
#, python-format
msgid "contents for index: %s"
msgstr "conteúdos para o índice: %s"
#: views.py:60
msgid "items"
msgstr "itens"
#: views.py:82
msgid "Are you sure you wish to rebuild all indexes?"
msgstr "Tem certeza de que deseja reconstruir todos os índices?"
#: views.py:83
msgid "On large databases this operation may take some time to execute."
msgstr ""
"Em grandes bases de dados esta operação pode levar algum tempo para executar."
#: views.py:89
msgid "Index rebuild completed successfully."
msgstr "Reconstrução de índice concluída com êxito."
#: views.py:94
#, python-format
msgid "Index rebuild error: %s"
msgstr "Reconstrução de índice de erro: %s"
#: views.py:109
#, python-format
msgid "indexes containing: %s"
msgstr "índices contendo: %s"
#: templates/indexing_help.html:3
msgid "What are indexes?"
msgstr "Quais são os índices?"
#: templates/indexing_help.html:4
msgid "Indexes group documents into a tree like hierarchical structure."
msgstr ""
"Indexar documentos agrupados em uma árvore como uma estrutura hierárquica."
@@ -0,0 +1,213 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Mayan EDMS\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-11-22 11:26-0400\n"
"PO-Revision-Date: 2011-11-03 22:42+0000\n"
"Last-Translator: gsv70 <gsv70@mail.ru>\n"
"Language-Team: Russian (http://www.transifex.net/projects/p/mayan-edms/team/"
"ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
#: __init__.py:12
msgid "View document indexes"
msgstr "Просмотр индексов документа"
#: __init__.py:13
msgid "Rebuild document indexes"
msgstr "Восстановление индексов документа"
#: __init__.py:15
msgid "Indexing"
msgstr "Индексирование"
#: __init__.py:19
msgid "index list"
msgstr "список индекса"
#: __init__.py:20
msgid "go up one level"
msgstr "перейти на уровень выше"
#: __init__.py:21 __init__.py:23 models.py:26
msgid "indexes"
msgstr "индексы"
#: __init__.py:25
msgid "rebuild indexes"
msgstr "восстановление индексов"
#: __init__.py:25
msgid "Deletes and creates from scratch all the document indexes."
msgstr "Удаляет и создается с нуля, все индексы документа."
#: __init__.py:27
msgid "Indexes"
msgstr "Индексы"
#: api.py:83
msgid "root"
msgstr "корень"
#: api.py:139
#, python-format
msgid "Maximum suffix (%s) count reached."
msgstr "Достигнуто максимальное (%s) число суффиксов "
#: api.py:175
#, python-format
msgid ""
"Error in document indexing update expression: %(expression)s; %(exception)s"
msgstr ""
"Ошибка в выражении обновления индексов документа: %(expression)s; "
"%(exception)s"
#: api.py:178
#, python-format
msgid ""
"Error updating document index, expression: %(expression)s; %(exception)s"
msgstr ""
"Ошибка при обновлении индекса документа, выражение: %(expression)s; "
"%(exception)s"
#: api.py:209
#, python-format
msgid "Unable to delete document indexing node; %s"
msgstr "Не удается удалить узел индексирования документов; %s."
#: filesystem.py:34
#, python-format
msgid "Unable to create indexing directory; %s"
msgstr "Не удается создать индексации каталога; %s."
#: filesystem.py:52
#, python-format
msgid ""
"Unable to create symbolic link, file exists and could not be deleted: "
"%(filepath)s; %(exc)s"
msgstr ""
"Невозможно создать символическую ссылку, файл существует и не может быть "
"удален: %(filepath)s; %(exc)s"
#: filesystem.py:54
#, python-format
msgid "Unable to create symbolic link: %(filepath)s; %(exc)s"
msgstr "Невозможно создать символическую ссылку: %(filepath)s; %(exc)s"
#: filesystem.py:71
#, python-format
msgid "Unable to delete document symbolic link; %s"
msgstr "Не удается удалить символическую ссылку документа;%s."
#: filesystem.py:83
#, python-format
msgid "Unable to delete indexing directory; %s"
msgstr "Не удается удалить каталог индексации; %s."
#: models.py:11
#, python-format
msgid "Available functions: %s"
msgstr "Доступные функции: %s."
#: models.py:16
msgid "indexing expression"
msgstr "выражение индексации "
#: models.py:16
msgid "Enter a python string expression to be evaluated."
msgstr "Введите строковое выражение питона для вычисления."
#: models.py:18
msgid "enabled"
msgstr "разрешено"
#: models.py:19
msgid "link documents"
msgstr "связать документы"
#: models.py:25 models.py:31 views.py:56
msgid "index"
msgstr "индекс"
#: models.py:32
msgid "value"
msgstr "значение"
#: models.py:33
msgid "documents"
msgstr "документы"
#: models.py:46 models.py:51
msgid "index instance"
msgstr "экземпляр индекса"
#: models.py:47
msgid "indexes instances"
msgstr "экземпляры индекса"
#: models.py:52
msgid "document"
msgstr "документ"
#: models.py:59
msgid "document rename count"
msgstr "счетчик переименования документа"
#: models.py:60
msgid "documents rename count"
msgstr "счетчик переименования документов"
#: utils.py:19
msgid "document indexes"
msgstr "индексы документов"
#: views.py:38
#, python-format
msgid "contents for index: %s"
msgstr "содержания для индекса: %s."
#: views.py:60
msgid "items"
msgstr "членов"
#: views.py:82
msgid "Are you sure you wish to rebuild all indexes?"
msgstr "Вы уверены, что хотите перестроить все индексы?"
#: views.py:83
msgid "On large databases this operation may take some time to execute."
msgstr ""
"В больших базах данных эта операция может занять некоторое время для "
"выполнения."
#: views.py:89
msgid "Index rebuild completed successfully."
msgstr "восстановление индекса успешно завершено."
#: views.py:94
#, python-format
msgid "Index rebuild error: %s"
msgstr "Индекс восстановить ошибка: %s"
#: views.py:109
#, python-format
msgid "indexes containing: %s"
msgstr "индексы, содержащие: %s"
#: templates/indexing_help.html:3
msgid "What are indexes?"
msgstr "что за индексы?"
#: templates/indexing_help.html:4
msgid "Indexes group documents into a tree like hierarchical structure."
msgstr "Индексы группы документов в древовидной иерархической структуре."
-8
View File
@@ -1,8 +0,0 @@
from document_indexing.conf.settings import SUFFIX_SEPARATOR
def assemble_document_filename(document, suffix=0):
if suffix:
return SUFFIX_SEPARATOR.join([document.file_filename, unicode(suffix)])
else:
return document.file_filename
+20
View File
@@ -0,0 +1,20 @@
import os
from document_indexing.conf.settings import SUFFIX_SEPARATOR
def assemble_suffixed_filename(filename, suffix=0):
'''
Split document filename, to attach suffix to the name part then
re attacht the extension
'''
if suffix:
name, extension = filename.split(os.split(os.extsep))
return SUFFIX_SEPARATOR.join([name, unicode(suffix), os.extsep, extension])
else:
return file_filename
def assemble_path_from_list(directory_list):
return os.sep.join(directory_list)
+47 -29
View File
@@ -6,37 +6,37 @@ from common.utils import validate_path, encapsulate
from navigation.api import register_links, register_top_menu, \
register_model_list_columns, register_multi_item_links, \
register_sidebar_template
from main.api import register_diagnostic, register_maintenance
from main.api import register_diagnostic, register_maintenance_links
from permissions.api import register_permission, set_namespace_title
from tags.widgets import get_tags_inline_widget_simple
from history.api import register_history_type
from metadata.api import get_metadata_string
from project_setup.api import register_setup
from documents.models import Document, DocumentPage, \
DocumentPageTransformation, DocumentType, DocumentTypeFilename
from documents.literals import PERMISSION_DOCUMENT_CREATE, \
PERMISSION_DOCUMENT_PROPERTIES_EDIT, PERMISSION_DOCUMENT_VIEW, \
PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD, \
PERMISSION_DOCUMENT_TRANSFORM, PERMISSION_DOCUMENT_TOOLS, \
PERMISSION_DOCUMENT_EDIT
from documents.literals import PERMISSION_DOCUMENT_TYPE_EDIT, \
PERMISSION_DOCUMENT_TYPE_DELETE, PERMISSION_DOCUMENT_TYPE_CREATE
from documents.literals import HISTORY_DOCUMENT_CREATED, \
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED
from documents.models import (Document, DocumentPage,
DocumentPageTransformation, DocumentType, DocumentTypeFilename,
DocumentVersion)
from documents.literals import (PERMISSION_DOCUMENT_CREATE,
PERMISSION_DOCUMENT_PROPERTIES_EDIT, PERMISSION_DOCUMENT_VIEW,
PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD,
PERMISSION_DOCUMENT_TRANSFORM, PERMISSION_DOCUMENT_TOOLS,
PERMISSION_DOCUMENT_EDIT, PERMISSION_DOCUMENT_VERSION_REVERT)
from documents.literals import (PERMISSION_DOCUMENT_TYPE_EDIT,
PERMISSION_DOCUMENT_TYPE_DELETE, PERMISSION_DOCUMENT_TYPE_CREATE)
from documents.literals import (HISTORY_DOCUMENT_CREATED,
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED)
from documents.conf.settings import ZOOM_MAX_LEVEL
from documents.conf.settings import ZOOM_MIN_LEVEL
from documents.conf import settings as document_settings
from documents.widgets import document_thumbnail
# Document page links expressions
def is_first_page(context):
return context['page'].page_number <= 1
def is_last_page(context):
return context['page'].page_number >= context['page'].document.documentpage_set.count()
return context['page'].page_number >= context['page'].document_version.pages.count()
def is_min_zoom(context):
@@ -46,6 +46,10 @@ def is_min_zoom(context):
def is_max_zoom(context):
return context['zoom'] >= ZOOM_MAX_LEVEL
def is_current_version(context):
return context['object'].document.latest_version.timestamp == context['object'].timestamp
# Permission setup
set_namespace_title('documents', _(u'Documents'))
register_permission(PERMISSION_DOCUMENT_CREATE)
@@ -56,6 +60,7 @@ register_permission(PERMISSION_DOCUMENT_DELETE)
register_permission(PERMISSION_DOCUMENT_DOWNLOAD)
register_permission(PERMISSION_DOCUMENT_TRANSFORM)
register_permission(PERMISSION_DOCUMENT_TOOLS)
register_permission(PERMISSION_DOCUMENT_VERSION_REVERT)
# Document type permissions
set_namespace_title('documents_setup', _(u'Documents setup'))
@@ -70,7 +75,7 @@ register_history_type(HISTORY_DOCUMENT_DELETED)
document_list = {'text': _(u'all documents'), 'view': 'document_list', 'famfam': 'page', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_list_recent = {'text': _(u'recent documents'), 'view': 'document_list_recent', 'famfam': 'page', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_create_multiple = {'text': _(u'upload new documents'), 'view': 'document_create_multiple', 'famfam': 'page_add', 'permissions': [PERMISSION_DOCUMENT_CREATE], 'children_view_regex': ['upload']}
document_create_multiple = {'text': _(u'upload new documents'), 'view': 'document_create_multiple', 'famfam': 'page_add', 'permissions': [PERMISSION_DOCUMENT_CREATE], 'children_view_regex': [r'upload_interactive']}
document_create_siblings = {'text': _(u'clone metadata'), 'view': 'document_create_siblings', 'args': 'object.id', 'famfam': 'page_copy', 'permissions': [PERMISSION_DOCUMENT_CREATE]}
document_view_simple = {'text': _(u'details'), 'view': 'document_view_simple', 'args': 'object.id', 'famfam': 'page', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_view_advanced = {'text': _(u'properties'), 'view': 'document_view_advanced', 'args': 'object.id', 'famfam': 'page_gear', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
@@ -79,13 +84,20 @@ document_multiple_delete = {'text': _(u'delete'), 'view': 'document_multiple_del
document_edit = {'text': _(u'edit'), 'view': 'document_edit', 'args': 'object.id', 'famfam': 'page_edit', 'permissions': [PERMISSION_DOCUMENT_PROPERTIES_EDIT]}
document_preview = {'text': _(u'preview'), 'class': 'fancybox', 'view': 'document_preview', 'args': 'object.id', 'famfam': 'magnifier', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_download = {'text': _(u'download'), 'view': 'document_download', 'args': 'object.id', 'famfam': 'page_save', 'permissions': [PERMISSION_DOCUMENT_DOWNLOAD]}
document_find_duplicates = {'text': _(u'find duplicates'), 'view': 'document_find_duplicates', 'args': 'object.id', 'famfam': 'page_refresh', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_find_all_duplicates = {'text': _(u'find all duplicates'), 'view': 'document_find_all_duplicates', 'famfam': 'page_refresh', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'description': _(u'Search all the documents\' checksums and return a list of the exact matches.')}
document_version_download = {'text': _(u'download'), 'view': 'document_version_download', 'args': 'object.pk', 'famfam': 'page_save', 'permissions': [PERMISSION_DOCUMENT_DOWNLOAD]}
document_find_duplicates = {'text': _(u'find duplicates'), 'view': 'document_find_duplicates', 'args': 'object.id', 'famfam': 'page_white_copy', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_find_all_duplicates = {'text': _(u'find all duplicates'), 'view': 'document_find_all_duplicates', 'famfam': 'page_white_copy', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'description': _(u'Search all the documents\' checksums and return a list of the exact matches.')}
document_update_page_count = {'text': _(u'update office documents\' page count'), 'view': 'document_update_page_count', 'famfam': 'page_white_csharp', 'permissions': [PERMISSION_DOCUMENT_TOOLS], 'description': _(u'Update the page count of the office type documents. This is useful when enabling office document support after there were already office type documents in the database.')}
document_clear_transformations = {'text': _(u'clear transformations'), 'view': 'document_clear_transformations', 'args': 'object.id', 'famfam': 'page_paintbrush', 'permissions': [PERMISSION_DOCUMENT_TRANSFORM]}
document_multiple_clear_transformations = {'text': _(u'clear transformations'), 'view': 'document_multiple_clear_transformations', 'famfam': 'page_paintbrush', 'permissions': [PERMISSION_DOCUMENT_TRANSFORM]}
document_print = {'text': _(u'print'), 'view': 'document_print', 'args': 'object.id', 'famfam': 'printer', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_history_view = {'text': _(u'history'), 'view': 'history_for_object', 'args': ['"documents"', '"document"', 'object.id'], 'famfam': 'book_go', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_missing_list = {'text': _(u'Find missing document files'), 'view': 'document_missing_list', 'famfam': 'folder_page', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
# Tools
document_clear_image_cache = {'text': _(u'Clear the document image cache'), 'view': 'document_clear_image_cache', 'famfam': 'camera_delete', 'permissions': [PERMISSION_DOCUMENT_TOOLS], 'description': _(u'Clear the graphics representations used to speed up the documents\' display and interactive transformations results.')}
# Document pages
document_page_transformation_list = {'text': _(u'page transformations'), 'class': 'no-parent-history', 'view': 'document_page_transformation_list', 'args': 'page.pk', 'famfam': 'pencil_go', 'permissions': [PERMISSION_DOCUMENT_TRANSFORM]}
document_page_transformation_create = {'text': _(u'create new transformation'), 'class': 'no-parent-history', 'view': 'document_page_transformation_create', 'args': 'page.pk', 'famfam': 'pencil_add', 'permissions': [PERMISSION_DOCUMENT_TRANSFORM]}
document_page_transformation_edit = {'text': _(u'edit'), 'class': 'no-parent-history', 'view': 'document_page_transformation_edit', 'args': 'transformation.pk', 'famfam': 'pencil_go', 'permissions': [PERMISSION_DOCUMENT_TRANSFORM]}
@@ -104,7 +116,9 @@ document_page_rotate_right = {'text': _(u'rotate right'), 'class': 'no-parent-hi
document_page_rotate_left = {'text': _(u'rotate left'), 'class': 'no-parent-history', 'view': 'document_page_rotate_left', 'args': 'page.pk', 'famfam': 'arrow_turn_left', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_page_view_reset = {'text': _(u'reset view'), 'class': 'no-parent-history', 'view': 'document_page_view_reset', 'args': 'page.pk', 'famfam': 'page_white', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_missing_list = {'text': _(u'Find missing document files'), 'view': 'document_missing_list', 'famfam': 'folder_page', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
# Document versions
document_version_list = {'text': _(u'versions'), 'view': 'document_version_list', 'args': 'object.pk', 'famfam': 'page_world', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
document_version_revert = {'text': _(u'revert'), 'view': 'document_version_revert', 'args': 'object.pk', 'famfam': 'page_refresh', 'permissions': [PERMISSION_DOCUMENT_VERSION_REVERT], 'conditional_disable': is_current_version}
# Document type related links
document_type_list = {'text': _(u'document type list'), 'view': 'document_type_list', 'famfam': 'layout', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
@@ -132,6 +146,9 @@ register_links(['document_type_filename_create', 'document_type_filename_list',
register_links(Document, [document_edit, document_print, document_delete, document_download, document_find_duplicates, document_clear_transformations, document_create_siblings])
register_multi_item_links(['document_find_duplicates', 'folder_view', 'index_instance_list', 'document_type_document_list', 'search', 'results', 'document_group_view', 'document_list', 'document_list_recent'], [document_multiple_clear_transformations, document_multiple_delete])
# Document Version links
register_links(DocumentVersion, [document_version_revert, document_version_download])
secondary_menu_links = [document_list_recent, document_list, document_create_multiple]
register_links(['document_list_recent', 'document_list', 'document_create', 'document_create_multiple', 'upload_interactive', 'staging_file_delete'], secondary_menu_links, menu_name='secondary_menu')
@@ -158,17 +175,16 @@ register_links(['document_page_transformation_edit', 'document_page_transformati
register_diagnostic('documents', _(u'Documents'), document_missing_list)
register_maintenance(document_find_all_duplicates, namespace='documents', title=_(u'documents'))
register_maintenance_links([document_find_all_duplicates, document_update_page_count, document_clear_image_cache], namespace='documents', title=_(u'documents'))
def document_exists(document):
try:
if document.exists():
return u'<span class="famfam active famfam-tick"></span>'
else:
return u'<span class="famfam active famfam-cross"></span>'
except Exception, exc:
return exc
#def document_exists(document):
# try:
# if document.exists():
# return u'<span class="famfam active famfam-tick"></span>'
# else:
# return u'<span class="famfam active famfam-cross"></span>'
# except Exception, exc:
# return exc
register_model_list_columns(Document, [
{'name':_(u'thumbnail'), 'attribute':
@@ -188,7 +204,8 @@ register_top_menu(
children_path_regex=[
r'^documents/[^t]', r'^metadata/[^s]', r'comments', r'tags/document', r'grouping/[^s]', r'history/list/for_object/documents'
],
children_views=['document_folder_list', 'folder_add_document', 'document_index_list'],
#children_view_regex=[r'upload'],
children_views=['document_folder_list', 'folder_add_document', 'document_index_list', 'upload_version',],
position=1
)
@@ -198,6 +215,7 @@ register_sidebar_template(['document_type_list'], 'document_types_help.html')
register_links(Document, [document_view_simple], menu_name='form_header', position=0)
register_links(Document, [document_view_advanced], menu_name='form_header', position=1)
register_links(Document, [document_history_view], menu_name='form_header')
register_links(Document, [document_version_list], menu_name='form_header')
if (validate_path(document_settings.CACHE_PATH) == False) or (not document_settings.CACHE_PATH):
setattr(document_settings, 'CACHE_PATH', tempfile.mkdtemp())
+23 -12
View File
@@ -2,11 +2,29 @@ from django.contrib import admin
from metadata.admin import DocumentMetadataInline
from documents.models import DocumentType, Document, \
DocumentTypeFilename, DocumentPage, \
DocumentPageTransformation, RecentDocument
from documents.models import (DocumentType, Document,
DocumentTypeFilename, DocumentPage,
DocumentPageTransformation, RecentDocument,
DocumentVersion)
class DocumentPageInline(admin.StackedInline):
model = DocumentPage
extra = 1
classes = ('collapse-open',)
allow_add = True
class DocumentVersionInline(admin.StackedInline):
model = DocumentVersion
extra = 1
classes = ('collapse-open',)
allow_add = True
#inlines = [
# DocumentPageInline,
#]
class DocumentTypeFilenameInline(admin.StackedInline):
model = DocumentTypeFilename
extra = 1
@@ -24,18 +42,11 @@ class DocumentPageTransformationAdmin(admin.ModelAdmin):
model = DocumentPageTransformation
class DocumentPageInline(admin.StackedInline):
model = DocumentPage
extra = 1
classes = ('collapse-open',)
allow_add = True
class DocumentAdmin(admin.ModelAdmin):
inlines = [
DocumentMetadataInline, DocumentPageInline
DocumentMetadataInline, DocumentVersionInline
]
list_display = ('uuid', 'file_filename', 'file_extension')
list_display = ('uuid', 'file_filename',)
class RecentDocumentAdmin(admin.ModelAdmin):
+88 -53
View File
@@ -9,11 +9,13 @@ from common.forms import DetailForm
from common.literals import PAGE_SIZE_CHOICES, PAGE_ORIENTATION_CHOICES
from common.conf.settings import DEFAULT_PAPER_SIZE
from common.conf.settings import DEFAULT_PAGE_ORIENTATION
from common.widgets import TextAreaDiv
from documents.models import Document, DocumentType, \
DocumentPage, DocumentPageTransformation, DocumentTypeFilename
from common.widgets import TextAreaDiv
from documents.models import (Document, DocumentType,
DocumentPage, DocumentPageTransformation, DocumentTypeFilename,
DocumentVersion)
from documents.widgets import document_html_widget
from documents.literals import (RELEASE_LEVEL_FINAL, RELEASE_LEVEL_CHOICES)
# Document page forms
class DocumentPageTransformationForm(forms.ModelForm):
@@ -32,22 +34,10 @@ class DocumentPageImageWidget(forms.widgets.Widget):
rotation = final_attrs.get('rotation', 0)
if value:
output = []
output.append('''
<div class="full-height scrollable" style="overflow: auto;">
<div class="tc">
<img class="lazy-load" data-href="%(img)s?page=%(page)d&zoom=%(zoom)d&rotation=%(rotation)d" src="%(static_url)s/images/ajax-loader.gif" alt="%(string)s" />
<noscript>
<img src="%(img)s?page=%(page)d&zoom=%(zoom)d&rotation=%(rotation)d" alt="%(string)s" />
</noscript>
</div>
</div>''' % {
'img': reverse('document_display', args=[value.document.id]),
'page': value.page_number,
'zoom': zoom,
'rotation': rotation,
'static_url': settings.STATIC_URL,
'string': ugettext(u'page image')
})
output.append('<div class="full-height scrollable" style="overflow: auto;">')
output.append(document_html_widget(value.document, view='document_display', page=value.page_number, zoom=zoom, rotation=rotation))
output.append('</div>')
return mark_safe(u''.join(output))
else:
return u''
@@ -112,36 +102,27 @@ class DocumentPagesCarouselWidget(forms.widgets.Widget):
output = []
output.append(u'<div style="white-space:nowrap; overflow: auto;">')
for page in value.documentpage_set.all():
for page in value.pages.all():
output.append(u'<div style="display: inline-block; margin: 5px 10px 10px 10px;">')
output.append(u'<div class="tc">%(page_string)s %(page)s</div>' % {'page_string': ugettext(u'Page'), 'page': page.page_number})
output.append(
u'''<div style="display: inline-block; margin: 5px 10px 10px 10px;">
<div class="tc">%(page_string)s %(page)s</div>
<div class="tc" style="border: 1px solid black; margin: 5px 0px 5px 0px;">
<a rel="page_gallery" class="fancybox-noscaling" href="%(view_url)s?page=%(page)d">
<img class="lazy-load" data-href="%(img)s?page=%(page)d" src="%(static_url)s/images/ajax-loader.gif" alt="%(string)s" />
<noscript>
<img src="%(img)s?page=%(page)d" alt="%(string)s" />
</noscript>
</a>
</div>
<div class="tc">
<a class="fancybox-iframe" href="%(url)s"><span class="famfam active famfam-page_white_go"></span>%(details_string)s</a>
</div>
</div>''' % {
'url': reverse('document_page_view', args=[page.pk]),
'img': reverse('document_preview_multipage', args=[value.pk]),
'page': page.page_number,
'view_url': reverse('document_display', args=[page.document.pk]),
'page_string': ugettext(u'Page'),
'details_string': ugettext(u'Details'),
'static_url': settings.STATIC_URL,
'string': _(u'document page')
})
document_html_widget(
page.document,
view='document_preview_multipage',
click_view='document_display',
page=page.page_number,
gallery_name='document_pages',
fancybox_class='fancybox-noscaling',
)
)
output.append(u'<div class="tc">')
output.append(u'<a class="fancybox-iframe" href="%s"><span class="famfam active famfam-page_white_go"></span>%s</a>' % (reverse('document_page_view', args=[page.pk]), ugettext(u'Details')))
output.append(u'</div>')
output.append(u'</div>')
output.append(u'</div>')
output.append(
u'<br /><span class="famfam active famfam-magnifier"></span>%s' %
ugettext(u'Click on the image for full size preview'))
output.append(u'<br /><span class="famfam active famfam-magnifier"></span>%s' % ugettext(u'Click on the image for full size preview'))
return mark_safe(u''.join(output))
@@ -151,7 +132,7 @@ class DocumentPreviewForm(forms.Form):
document = kwargs.pop('document', None)
super(DocumentPreviewForm, self).__init__(*args, **kwargs)
self.fields['preview'].initial = document
self.fields['preview'].label = _(u'Document pages (%s)') % document.documentpage_set.count()
self.fields['preview'].label = _(u'Document pages (%s)') % document.pages.count()
preview = forms.CharField(widget=DocumentPagesCarouselWidget())
@@ -175,6 +156,13 @@ class DocumentForm(forms.ModelForm):
# To allow merging with DocumentForm_edit
self.fields['document_type'].widget = forms.HiddenInput()
if instance:
self.fields['use_file_name'] = forms.BooleanField(
label=_(u'Use the new version filename as the document filename'),
initial=False,
required=False,
)
# Instance's document_type overrides the passed document_type
if instance:
if hasattr(instance, 'document_type'):
@@ -188,10 +176,50 @@ class DocumentForm(forms.ModelForm):
required=False,
label=_(u'Quick document rename'))
if instance:
self.version_fields(instance)
def version_fields(self, document):
self.fields['version_update'] = forms.ChoiceField(
label=_(u'Version update'),
choices=DocumentVersion.get_version_update_choices(document.latest_version)
)
self.fields['release_level'] = forms.ChoiceField(
label=_(u'Release level'),
choices=RELEASE_LEVEL_CHOICES,
initial=RELEASE_LEVEL_FINAL,
)
self.fields['serial'] = forms.IntegerField(
label=_(u'Release level serial'),
initial=0,
widget=forms.widgets.TextInput(
attrs = {'style': 'width: auto;'}
),
)
self.fields['comment'] = forms.CharField(
label=_(u'Comment'),
required=False,
widget=forms.widgets.Textarea(attrs={'rows': 4}),
)
new_filename = forms.CharField(
label=_('New document filename'), required=False
)
def clean(self):
cleaned_data = self.cleaned_data
cleaned_data['new_version_data'] = {
'comment': self.cleaned_data.get('comment'),
'version_update': self.cleaned_data.get('version_update'),
'release_level': self.cleaned_data.get('release_level'),
'serial': self.cleaned_data.get('serial'),
}
# Always return the full collection of cleaned data.
return cleaned_data
class DocumentForm_edit(DocumentForm):
"""
@@ -200,6 +228,13 @@ class DocumentForm_edit(DocumentForm):
class Meta:
model = Document
exclude = ('file', 'document_type', 'tags')
def __init__(self, *args, **kwargs):
super(DocumentForm_edit, self).__init__(*args, **kwargs)
self.fields.pop('serial')
self.fields.pop('release_level')
self.fields.pop('version_update')
self.fields.pop('comment')
class DocumentPropertiesForm(DetailForm):
@@ -221,7 +256,7 @@ class DocumentContentForm(forms.Form):
super(DocumentContentForm, self).__init__(*args, **kwargs)
content = []
self.fields['contents'].initial = u''
for page in self.document.documentpage_set.all():
for page in self.document.pages.all():
if page.content:
content.append(page.content)
content.append(u'\n\n\n - Page %s - \n\n\n' % page.page_number)
@@ -243,10 +278,10 @@ class DocumentTypeSelectForm(forms.Form):
class PrintForm(forms.Form):
page_size = forms.ChoiceField(choices=PAGE_SIZE_CHOICES, initial=DEFAULT_PAPER_SIZE, label=_(u'Page size'), required=False)
custom_page_width = forms.CharField(label=_(u'Custom page width'), required=False)
custom_page_height = forms.CharField(label=_(u'Custom page height'), required=False)
page_orientation = forms.ChoiceField(choices=PAGE_ORIENTATION_CHOICES, initial=DEFAULT_PAGE_ORIENTATION, label=_(u'Page orientation'), required=True)
#page_size = forms.ChoiceField(choices=PAGE_SIZE_CHOICES, initial=DEFAULT_PAPER_SIZE, label=_(u'Page size'), required=False)
#custom_page_width = forms.CharField(label=_(u'Custom page width'), required=False)
#custom_page_height = forms.CharField(label=_(u'Custom page height'), required=False)
#page_orientation = forms.ChoiceField(choices=PAGE_ORIENTATION_CHOICES, initial=DEFAULT_PAGE_ORIENTATION, label=_(u'Page orientation'), required=True)
page_range = forms.CharField(label=_(u'Page range'), required=False)
+19
View File
@@ -13,6 +13,7 @@ PERMISSION_DOCUMENT_DELETE = {'namespace': 'documents', 'name': 'document_delete
PERMISSION_DOCUMENT_DOWNLOAD = {'namespace': 'documents', 'name': 'document_download', 'label': _(u'Download documents')}
PERMISSION_DOCUMENT_TRANSFORM = {'namespace': 'documents', 'name': 'document_transform', 'label': _(u'Transform documents')}
PERMISSION_DOCUMENT_TOOLS = {'namespace': 'documents', 'name': 'document_tools', 'label': _(u'Execute document modifying tools')}
PERMISSION_DOCUMENT_VERSION_REVERT = {'namespace': 'documents', 'name': 'document_version_revert', 'label': _(u'Revert documents to a previous version')}
PERMISSION_DOCUMENT_TYPE_EDIT = {'namespace': 'documents_setup', 'name': 'document_type_edit', 'label': _(u'Edit document types')}
PERMISSION_DOCUMENT_TYPE_DELETE = {'namespace': 'documents_setup', 'name': 'document_type_delete', 'label': _(u'Delete document types')}
@@ -44,3 +45,21 @@ HISTORY_DOCUMENT_DELETED = {
'details': _(u'Document "%(document)s" deleted on %(datetime)s by %(fullname)s.'),
'expressions': {'fullname': 'user.get_full_name() if user.get_full_name() else user.username'}
}
RELEASE_LEVEL_FINAL = 1
RELEASE_LEVEL_ALPHA = 2
RELEASE_LEVEL_BETA = 3
RELEASE_LEVEL_RC = 4
RELEASE_LEVEL_HF = 5
RELEASE_LEVEL_CHOICES = (
(RELEASE_LEVEL_FINAL, _(u'final')),
(RELEASE_LEVEL_ALPHA, _(u'alpha')),
(RELEASE_LEVEL_BETA, _(u'beta')),
(RELEASE_LEVEL_RC, _(u'release candidate')),
(RELEASE_LEVEL_HF, _(u'hotfix')),
)
VERSION_UPDATE_MAJOR = u'major'
VERSION_UPDATE_MINOR = u'minor'
VERSION_UPDATE_MICRO = u'micro'
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
+219
View File
@@ -0,0 +1,219 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DocumentType'
db.create_table('documents_documenttype', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('name', self.gf('django.db.models.fields.CharField')(max_length=32)),
))
db.send_create_signal('documents', ['DocumentType'])
# Adding model 'Document'
db.create_table('documents_document', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('document_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType'], null=True, blank=True)),
('file', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
('uuid', self.gf('django.db.models.fields.CharField')(default=u'107e50a8-83b3-46da-bd14-460489527ab1', max_length=48, blank=True)),
('file_mimetype', self.gf('django.db.models.fields.CharField')(default='', max_length=64)),
('file_mime_encoding', self.gf('django.db.models.fields.CharField')(default='', max_length=64)),
('file_filename', self.gf('django.db.models.fields.CharField')(default=u'', max_length=255, db_index=True)),
('file_extension', self.gf('django.db.models.fields.CharField')(default=u'', max_length=16, db_index=True)),
('date_added', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, db_index=True, blank=True)),
('date_updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
('checksum', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
('description', self.gf('django.db.models.fields.TextField')(db_index=True, null=True, blank=True)),
))
db.send_create_signal('documents', ['Document'])
# Adding model 'DocumentTypeFilename'
db.create_table('documents_documenttypefilename', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('document_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentType'])),
('filename', self.gf('django.db.models.fields.CharField')(max_length=128, db_index=True)),
('enabled', self.gf('django.db.models.fields.BooleanField')(default=True)),
))
db.send_create_signal('documents', ['DocumentTypeFilename'])
# Adding model 'DocumentPage'
db.create_table('documents_documentpage', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('document', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document'])),
('content', self.gf('django.db.models.fields.TextField')(db_index=True, null=True, blank=True)),
('page_label', self.gf('django.db.models.fields.CharField')(max_length=32, null=True, blank=True)),
('page_number', self.gf('django.db.models.fields.PositiveIntegerField')(default=1, db_index=True)),
))
db.send_create_signal('documents', ['DocumentPage'])
# Adding model 'DocumentPageTransformation'
db.create_table('documents_documentpagetransformation', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('document_page', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentPage'])),
('order', self.gf('django.db.models.fields.PositiveIntegerField')(default=0, null=True, db_index=True, blank=True)),
('transformation', self.gf('django.db.models.fields.CharField')(max_length=128)),
('arguments', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
))
db.send_create_signal('documents', ['DocumentPageTransformation'])
# Adding model 'RecentDocument'
db.create_table('documents_recentdocument', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
('document', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document'])),
('datetime_accessed', self.gf('django.db.models.fields.DateTimeField')(db_index=True)),
))
db.send_create_signal('documents', ['RecentDocument'])
def backwards(self, orm):
# Deleting model 'DocumentType'
db.delete_table('documents_documenttype')
# Deleting model 'Document'
db.delete_table('documents_document')
# Deleting model 'DocumentTypeFilename'
db.delete_table('documents_documenttypefilename')
# Deleting model 'DocumentPage'
db.delete_table('documents_documentpage')
# Deleting model 'DocumentPageTransformation'
db.delete_table('documents_documentpagetransformation')
# Deleting model 'RecentDocument'
db.delete_table('documents_recentdocument')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'file_extension': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '16', 'db_index': 'True'}),
'file_filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'file_mime_encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file_mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'107e50a8-83b3-46da-bd14-460489527ab1'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,146 @@
# encoding: utf-8
import os
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
for document in orm.Document.objects.all():
document.file_filename = os.extsep.join([document.file_filename, document.file_extension])
document.save()
def backwards(self, orm):
"Write your backwards methods here."
for document in orm.Document.objects.all():
document.file_filename, document.file_extension = document.file_filename.split(os.extsep)
document.save()
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'file_extension': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '16', 'db_index': 'True'}),
'file_filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'file_mime_encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file_mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'28bd60c6-a5c2-4adb-8dab-1b6c0098cc9c'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,144 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Document.file_extension'
db.delete_column('documents_document', 'file_extension')
def backwards(self, orm):
# Adding field 'Document.file_extension'
db.add_column('documents_document', 'file_extension', self.gf('django.db.models.fields.CharField')(default=u'', max_length=16, db_index=True), keep_default=False)
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'file_filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'file_mime_encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file_mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'06a88ff6-11b2-44b3-8409-21bd58577d4f'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,188 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DocumentVersion'
db.create_table('documents_documentversion', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('document', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document'], null=True, blank=True)),
('mayor', self.gf('django.db.models.fields.PositiveIntegerField')(default=1)),
('minor', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('micro', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('release_level', self.gf('django.db.models.fields.PositiveIntegerField')(default=1)),
('serial', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
('timestamp', self.gf('django.db.models.fields.DateTimeField')()),
('file', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
('mimetype', self.gf('django.db.models.fields.CharField')(default='', max_length=64)),
('encoding', self.gf('django.db.models.fields.CharField')(default='', max_length=64)),
('filename', self.gf('django.db.models.fields.CharField')(default=u'', max_length=255, db_index=True)),
('checksum', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
))
db.send_create_signal('documents', ['DocumentVersion'])
# Adding unique constraint on 'DocumentVersion', fields ['document', 'mayor', 'minor', 'micro', 'release_level', 'serial']
db.create_unique('documents_documentversion', ['document_id', 'mayor', 'minor', 'micro', 'release_level', 'serial'])
# Adding field 'DocumentPage.document_version'
db.add_column('documents_documentpage', 'document_version', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion'], null=True, blank=True), keep_default=False)
def backwards(self, orm):
# Removing unique constraint on 'DocumentVersion', fields ['document', 'mayor', 'minor', 'micro', 'release_level', 'serial']
db.delete_unique('documents_documentversion', ['document_id', 'mayor', 'minor', 'micro', 'release_level', 'serial'])
# Deleting model 'DocumentVersion'
db.delete_table('documents_documentversion')
# Deleting field 'DocumentPage.document_version'
db.delete_column('documents_documentpage', 'document_version_id')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'file_filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'file_mime_encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file_mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'a8389d7d-b9f4-4e51-ac24-dd9dd310fd8c'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'mayor', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']", 'null': 'True', 'blank': 'True'}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mayor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,176 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for document in orm.Document.objects.all():
document_version = document.documentversion_set.create(
document = document,
timestamp = document.date_added,
file = document.file,
mimetype = document.file_mimetype,
encoding = document.file_mime_encoding,
filename = document.file_filename,
checksum = document.checksum,
)
document_version.save()
for document_page in document.documentpage_set.all():
document_page.document_version = document_version
document_page.save()
def backwards(self, orm):
for document in orm.Document.objects.all():
document_version = document.documentversion_set.all()[0]
document.date_added = document_version.timestamp
document.file = document_version.file
document.file_mimetype = document_version.mimetype
document.file_mime_encoding = document_version.encoding
document.filename = document_version.filename
document.checksum = document_version.checksum
document.save()
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'file_filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'file_mime_encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file_mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'6c189f1f-1d85-48b5-9b7d-e8e319603e77'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'mayor', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']", 'null': 'True', 'blank': 'True'}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mayor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,159 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
qs = orm.DocumentPage.objects.filter(document_version=None)
#print 'Invalid document pages to delete: %s' % qs.count()
for document_page in qs:
document_page.delete()
def backwards(self, orm):
def backwards(self, orm):
raise RuntimeError('Cannot reverse this migration.')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'file_filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'file_mime_encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file_mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'6c189f1f-1d85-48b5-9b7d-e8e319603e77'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'mayor', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']", 'null': 'True', 'blank': 'True'}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mayor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,202 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'DocumentVersion.document'
db.alter_column('documents_documentversion', 'document_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document']))
# Deleting field 'Document.date_updated'
db.delete_column('documents_document', 'date_updated')
# Deleting field 'Document.file'
db.delete_column('documents_document', 'file')
# Deleting field 'Document.file_filename'
db.delete_column('documents_document', 'file_filename')
# Deleting field 'Document.file_mimetype'
db.delete_column('documents_document', 'file_mimetype')
# Deleting field 'Document.checksum'
db.delete_column('documents_document', 'checksum')
# Deleting field 'Document.file_mime_encoding'
db.delete_column('documents_document', 'file_mime_encoding')
# Deleting field 'DocumentPage.document'
db.delete_column('documents_documentpage', 'document_id')
# Changing field 'DocumentPage.document_version'
db.alter_column('documents_documentpage', 'document_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion']))
def backwards(self, orm):
# Changing field 'DocumentVersion.document'
db.alter_column('documents_documentversion', 'document_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.Document'], null=True))
# Adding field 'Document.date_updated'
db.add_column('documents_document', 'date_updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, default=datetime.datetime(2011, 12, 2, 2, 17, 25, 53565), blank=True), keep_default=False)
# Adding field 'Document.file'
db.add_column('documents_document', 'file', self.gf('django.db.models.fields.files.FileField')(default='', max_length=100), keep_default=False)
# Adding field 'Document.file_filename'
db.add_column('documents_document', 'file_filename', self.gf('django.db.models.fields.CharField')(default=u'', max_length=255, db_index=True), keep_default=False)
# Adding field 'Document.file_mimetype'
db.add_column('documents_document', 'file_mimetype', self.gf('django.db.models.fields.CharField')(default='', max_length=64), keep_default=False)
# Adding field 'Document.checksum'
db.add_column('documents_document', 'checksum', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False)
# Adding field 'Document.file_mime_encoding'
db.add_column('documents_document', 'file_mime_encoding', self.gf('django.db.models.fields.CharField')(default='', max_length=64), keep_default=False)
# Adding field 'DocumentPage.document'
db.add_column('documents_documentpage', 'document', self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['documents.Document']), keep_default=False)
# Changing field 'DocumentPage.document_version'
db.alter_column('documents_documentpage', 'document_version_id', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['documents.DocumentVersion'], null=True))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'83100718-e901-4880-95f8-3618749c8a99'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'mayor', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mayor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,172 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'DocumentVersion', fields ['release_level', 'micro', 'serial', 'document', 'mayor', 'minor']
db.delete_unique('documents_documentversion', ['release_level', 'micro', 'serial', 'document_id', 'mayor', 'minor'])
# Deleting field 'DocumentVersion.mayor'
db.delete_column('documents_documentversion', 'mayor')
# Adding field 'DocumentVersion.major'
db.add_column('documents_documentversion', 'major', self.gf('django.db.models.fields.PositiveIntegerField')(default=1), keep_default=False)
# Adding unique constraint on 'DocumentVersion', fields ['major', 'release_level', 'micro', 'serial', 'document', 'minor']
db.create_unique('documents_documentversion', ['major', 'release_level', 'micro', 'serial', 'document_id', 'minor'])
def backwards(self, orm):
# Removing unique constraint on 'DocumentVersion', fields ['major', 'release_level', 'micro', 'serial', 'document', 'minor']
db.delete_unique('documents_documentversion', ['major', 'release_level', 'micro', 'serial', 'document_id', 'minor'])
# Adding field 'DocumentVersion.mayor'
db.add_column('documents_documentversion', 'mayor', self.gf('django.db.models.fields.PositiveIntegerField')(default=1), keep_default=False)
# Deleting field 'DocumentVersion.major'
db.delete_column('documents_documentversion', 'major')
# Adding unique constraint on 'DocumentVersion', fields ['release_level', 'micro', 'serial', 'document', 'mayor', 'minor']
db.create_unique('documents_documentversion', ['release_level', 'micro', 'serial', 'document_id', 'mayor', 'minor'])
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'750a3848-39cf-45a5-9a96-e948d09833d7'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'major', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'major': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,155 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DocumentVersion.comment'
db.add_column('documents_documentversion', 'comment', self.gf('django.db.models.fields.TextField')(default='', blank=True), keep_default=False)
def backwards(self, orm):
# Deleting field 'DocumentVersion.comment'
db.delete_column('documents_documentversion', 'comment')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'default': "u'123068ef-26d2-45bb-8933-cb6818cd87e4'", 'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'major', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'major': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,155 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Document.date_added'
db.alter_column('documents_document', 'date_added', self.gf('django.db.models.fields.DateTimeField')())
def backwards(self, orm):
# Changing field 'Document.date_added'
db.alter_column('documents_document', 'date_added', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True))
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'date_added': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'major', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'major': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
@@ -0,0 +1,156 @@
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DocumentVersion.signature_state'
db.add_column('documents_documentversion', 'signature_state', self.gf('django.db.models.fields.CharField')(max_length=16, null=True, blank=True), keep_default=False)
def backwards(self, orm):
# Deleting field 'DocumentVersion.signature_state'
db.delete_column('documents_documentversion', 'signature_state')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'comments.comment': {
'Meta': {'ordering': "('submit_date',)", 'object_name': 'Comment', 'db_table': "'django_comments'"},
'comment': ('django.db.models.fields.TextField', [], {'max_length': '3000'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'content_type_set_for_comment'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_removed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'object_pk': ('django.db.models.fields.TextField', [], {}),
'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
'submit_date': ('django.db.models.fields.DateTimeField', [], {'default': 'None'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comment_comments'", 'null': 'True', 'to': "orm['auth.User']"}),
'user_email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'user_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
'user_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'documents.document': {
'Meta': {'ordering': "['-date_added']", 'object_name': 'Document'},
'date_added': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'uuid': ('django.db.models.fields.CharField', [], {'max_length': '48', 'blank': 'True'})
},
'documents.documentpage': {
'Meta': {'ordering': "['page_number']", 'object_name': 'DocumentPage'},
'content': ('django.db.models.fields.TextField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'document_version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentVersion']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'page_label': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'}),
'page_number': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
},
'documents.documentpagetransformation': {
'Meta': {'ordering': "('order',)", 'object_name': 'DocumentPageTransformation'},
'arguments': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'document_page': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentPage']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'order': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'transformation': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'documents.documenttype': {
'Meta': {'ordering': "['name']", 'object_name': 'DocumentType'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '32'})
},
'documents.documenttypefilename': {
'Meta': {'ordering': "['filename']", 'object_name': 'DocumentTypeFilename'},
'document_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.DocumentType']"}),
'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'filename': ('django.db.models.fields.CharField', [], {'max_length': '128', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'documents.documentversion': {
'Meta': {'unique_together': "(('document', 'major', 'minor', 'micro', 'release_level', 'serial'),)", 'object_name': 'DocumentVersion'},
'checksum': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'comment': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'encoding': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
'filename': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '255', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'major': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'micro': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'mimetype': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
'minor': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'release_level': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1'}),
'serial': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'signature_state': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'blank': 'True'}),
'timestamp': ('django.db.models.fields.DateTimeField', [], {})
},
'documents.recentdocument': {
'Meta': {'ordering': "('-datetime_accessed',)", 'object_name': 'RecentDocument'},
'datetime_accessed': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['documents.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'sites.site': {
'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'taggit.tag': {
'Meta': {'object_name': 'Tag'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '100', 'db_index': 'True'})
},
'taggit.taggeditem': {
'Meta': {'object_name': 'TaggedItem'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_tagged_items'", 'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'object_id': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'taggit_taggeditem_items'", 'to': "orm['taggit.Tag']"})
}
}
complete_apps = ['documents']
+411 -141
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

+4 -3
View File
@@ -1,5 +1,5 @@
{% load project_tags %}
{% load printing_tags %}
{#{% load printing_tags %}#}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
@@ -48,9 +48,10 @@
</head>
<body>
{% for page in pages %}
{% get_document_size object %}
{#{% get_document_size object %}#}
<div class="{% if forloop.counter > 1 and not forloop.last %}break{% endif %}">
<img src="{% url document_display_print object.id %}?page={{ page.page_number }}" {% if document_aspect > page_aspect %}width="97%"{% else %}height="97%"{% endif %} />
{#<img src="{% url document_display_print object.id %}?page={{ page.page_number }}" {% if document_aspect > page_aspect %}width="97%"{% else %}height="97%"{% endif %} />#}
<img src="{% url document_display_print object.id %}?page={{ page.page_number }}" />
</div>
{% endfor %}
+2 -2
View File
@@ -1,6 +1,6 @@
from django.template import Library, Node, Variable
from converter.api import get_document_dimensions
from converter.api import get_dimensions
from documents.conf.settings import PRINT_SIZE
@@ -13,7 +13,7 @@ class GetImageSizeNode(Node):
def render(self, context):
document = Variable(self.document).resolve(context)
width, height = get_document_dimensions(document)
width, height = get_dimensions(document)
context[u'document_width'], context['document_height'] = width, height
context[u'document_aspect'] = float(width) / float(height)
return u''
+10
View File
@@ -25,13 +25,23 @@ urlpatterns = patterns('documents.views',
url(r'^(?P<document_id>\d+)/display/$', 'get_document_image', {'size': DISPLAY_SIZE}, 'document_display'),
url(r'^(?P<document_id>\d+)/display/print/$', 'get_document_image', {'size': PRINT_SIZE}, 'document_display_print'),
url(r'^(?P<document_id>\d+)/display/preview/base64/$', 'get_document_image', {'size': PREVIEW_SIZE, 'base64_version': True}, 'document_preview_base64'),
url(r'^(?P<document_id>\d+)/display/preview/multipage/base64/$', 'get_document_image', {'size': MULTIPAGE_PREVIEW_SIZE, 'base64_version': True}, 'document_preview_multipage_base64'),
url(r'^(?P<document_id>\d+)/display/thumbnail/base64/$', 'get_document_image', {'size': THUMBNAIL_SIZE, 'base64_version': True}, 'document_thumbnail_base64'),
url(r'^(?P<document_id>\d+)/download/$', 'document_download', (), 'document_download'),
url(r'^(?P<document_id>\d+)/create/siblings/$', 'document_create_siblings', (), 'document_create_siblings'),
url(r'^(?P<document_id>\d+)/find_duplicates/$', 'document_find_duplicates', (), 'document_find_duplicates'),
url(r'^(?P<document_id>\d+)/clear_transformations/$', 'document_clear_transformations', (), 'document_clear_transformations'),
url(r'^(?P<document_pk>\d+)/version/all/$', 'document_version_list', (), 'document_version_list'),
url(r'^document/version/(?P<document_version_pk>\d+)/download/$', 'document_download', (), 'document_version_download'),
url(r'^document/version/(?P<document_version_pk>\d+)/revert/$', 'document_version_revert', (), 'document_version_revert'),
url(r'^multiple/clear_transformations/$', 'document_multiple_clear_transformations', (), 'document_multiple_clear_transformations'),
url(r'^duplicates/list/$', 'document_find_all_duplicates', (), 'document_find_all_duplicates'),
url(r'^maintenance/update_page_count/$', 'document_update_page_count', (), 'document_update_page_count'),
url(r'^maintenance/clear_image_cache/$', 'document_clear_image_cache', (), 'document_clear_image_cache'),
url(r'^page/(?P<document_page_id>\d+)/$', 'document_page_view', (), 'document_page_view'),
url(r'^page/(?P<document_page_id>\d+)/text/$', 'document_page_text', (), 'document_page_text'),
+188 -57
View File
@@ -2,7 +2,7 @@ import urlparse
import copy
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponseRedirect
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.contrib import messages
@@ -18,7 +18,8 @@ from common.literals import PAGE_SIZE_DIMENSIONS, \
PAGE_ORIENTATION_PORTRAIT, PAGE_ORIENTATION_LANDSCAPE
from common.conf.settings import DEFAULT_PAPER_SIZE
from converter.literals import DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, \
DEFAULT_PAGE_NUMBER
DEFAULT_PAGE_NUMBER, DEFAULT_FILE_FORMAT_MIMETYPE
from converter.office_converter import OfficeConverter
from filetransfers.api import serve_file
from metadata.forms import MetadataFormSet, MetadataSelectionForm
from navigation.utils import resolve_to_name
@@ -35,25 +36,27 @@ from documents.conf.settings import ROTATION_STEP
from documents.conf.settings import PRINT_SIZE
from documents.conf.settings import RECENT_COUNT
from documents.literals import PERMISSION_DOCUMENT_CREATE, \
PERMISSION_DOCUMENT_PROPERTIES_EDIT, \
PERMISSION_DOCUMENT_VIEW, \
PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD, \
PERMISSION_DOCUMENT_TRANSFORM, \
PERMISSION_DOCUMENT_EDIT
from documents.literals import HISTORY_DOCUMENT_CREATED, \
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED
from documents.literals import (PERMISSION_DOCUMENT_CREATE,
PERMISSION_DOCUMENT_PROPERTIES_EDIT,
PERMISSION_DOCUMENT_VIEW,
PERMISSION_DOCUMENT_DELETE, PERMISSION_DOCUMENT_DOWNLOAD,
PERMISSION_DOCUMENT_TRANSFORM,
PERMISSION_DOCUMENT_EDIT, PERMISSION_DOCUMENT_TOOLS,
PERMISSION_DOCUMENT_VERSION_REVERT)
from documents.literals import (HISTORY_DOCUMENT_CREATED,
HISTORY_DOCUMENT_EDITED, HISTORY_DOCUMENT_DELETED)
from documents.forms import DocumentTypeSelectForm, \
DocumentForm_edit, DocumentPropertiesForm, \
DocumentPreviewForm, \
DocumentPageForm, DocumentPageTransformationForm, \
DocumentContentForm, DocumentPageForm_edit, \
DocumentPageForm_text, PrintForm, DocumentTypeForm, \
DocumentTypeFilenameForm, DocumentTypeFilenameForm_create
from documents.forms import (DocumentTypeSelectForm,
DocumentForm_edit, DocumentPropertiesForm,
DocumentPreviewForm, DocumentPageForm,
DocumentPageTransformationForm, DocumentContentForm,
DocumentPageForm_edit, DocumentPageForm_text, PrintForm,
DocumentTypeForm, DocumentTypeFilenameForm,
DocumentTypeFilenameForm_create)
from documents.wizards import DocumentCreateWizard
from documents.models import Document, DocumentType, DocumentPage, \
DocumentPageTransformation, RecentDocument, DocumentTypeFilename
from documents.models import (Document, DocumentType, DocumentPage,
DocumentPageTransformation, RecentDocument, DocumentTypeFilename,
DocumentVersion)
# Document type permissions
from documents.literals import PERMISSION_DOCUMENT_TYPE_EDIT, \
@@ -64,7 +67,7 @@ def document_list(request, object_list=None, title=None, extra_context=None):
check_permissions(request.user, [PERMISSION_DOCUMENT_VIEW])
context = {
'object_list': object_list if not (object_list is None) else Document.objects.only('file_filename', 'file_extension').all(),
'object_list': object_list if not (object_list is None) else Document.objects.all(),
'title': title if title else _(u'documents'),
'multi_select_as_buttons': True,
'hide_links': True,
@@ -113,18 +116,17 @@ def document_view(request, document_id, advanced=False):
if advanced:
document_properties_form = DocumentPropertiesForm(instance=document, extra_fields=[
{'label': _(u'Filename'), 'field': 'file_filename'},
{'label': _(u'File extension'), 'field': 'file_extension'},
{'label': _(u'Filename'), 'field': 'filename'},
{'label': _(u'File mimetype'), 'field': 'file_mimetype'},
{'label': _(u'File mime encoding'), 'field': 'file_mime_encoding'},
{'label': _(u'File size'), 'field':lambda x: pretty_size(x.file.storage.size(x.file.path)) if x.exists() else '-'},
{'label': _(u'File size'), 'field':lambda x: pretty_size(x.size) if x.size else '-'},
{'label': _(u'Exists in storage'), 'field': 'exists'},
{'label': _(u'File path in storage'), 'field': 'file'},
{'label': _(u'Date added'), 'field':lambda x: x.date_added.date()},
{'label': _(u'Time added'), 'field':lambda x: unicode(x.date_added.time()).split('.')[0]},
{'label': _(u'Checksum'), 'field': 'checksum'},
{'label': _(u'UUID'), 'field': 'uuid'},
{'label': _(u'Pages'), 'field': lambda x: x.documentpage_set.count()},
{'label': _(u'Pages'), 'field': 'page_count'},
])
subtemplates_list.append(
@@ -241,15 +243,15 @@ def document_edit(request, document_id):
for warning in warnings:
messages.warning(request, warning)
document.file_filename = form.cleaned_data['new_filename']
document.filename = form.cleaned_data['new_filename']
document.description = form.cleaned_data['description']
if 'document_type_available_filenames' in form.cleaned_data:
if form.cleaned_data['document_type_available_filenames']:
document.file_filename = form.cleaned_data['document_type_available_filenames'].filename
document.filename = form.cleaned_data['document_type_available_filenames'].filename
document.save()
create_history(HISTORY_DOCUMENT_EDITED, document, {'user': request.user, 'diff': return_diff(old_document, document, ['file_filename', 'description'])})
create_history(HISTORY_DOCUMENT_EDITED, document, {'user': request.user, 'diff': return_diff(old_document, document, ['filename', 'description'])})
RecentDocument.objects.add_document_for_user(request.user, document)
messages.success(request, _(u'Document "%s" edited successfully.') % document)
@@ -262,7 +264,7 @@ def document_edit(request, document_id):
return HttpResponseRedirect(document.get_absolute_url())
else:
form = DocumentForm_edit(instance=document, initial={
'new_filename': document.file_filename})
'new_filename': document.filename})
return render_to_response('generic_form.html', {
'form': form,
@@ -270,7 +272,7 @@ def document_edit(request, document_id):
}, context_instance=RequestContext(request))
def get_document_image(request, document_id, size=PREVIEW_SIZE):
def get_document_image(request, document_id, size=PREVIEW_SIZE, base64_version=False):
check_permissions(request.user, [PERMISSION_DOCUMENT_VIEW])
document = get_object_or_404(Document, pk=document_id)
@@ -278,6 +280,8 @@ def get_document_image(request, document_id, size=PREVIEW_SIZE):
page = int(request.GET.get('page', DEFAULT_PAGE_NUMBER))
zoom = int(request.GET.get('zoom', DEFAULT_ZOOM_LEVEL))
version = int(request.GET.get('version', document.latest_version.pk))
if zoom < ZOOM_MIN_LEVEL:
zoom = ZOOM_MIN_LEVEL
@@ -287,21 +291,30 @@ def get_document_image(request, document_id, size=PREVIEW_SIZE):
rotation = int(request.GET.get('rotation', DEFAULT_ROTATION)) % 360
return sendfile.sendfile(request, document.get_image(size=size, page=page, zoom=zoom, rotation=rotation))
if base64_version:
return HttpResponse(u'<html><body><img src="%s" /></body></html>' % document.get_image(size=size, page=page, zoom=zoom, rotation=rotation, as_base64=True, version=version))
else:
# TODO: fix hardcoded MIMETYPE
return sendfile.sendfile(request, document.get_image(size=size, page=page, zoom=zoom, rotation=rotation, version=version), mimetype=DEFAULT_FILE_FORMAT_MIMETYPE)
def document_download(request, document_id):
def document_download(request, document_id=None, document_version_pk=None):
check_permissions(request.user, [PERMISSION_DOCUMENT_DOWNLOAD])
document = get_object_or_404(Document, pk=document_id)
if document_version_pk:
document_version = get_object_or_404(DocumentVersion, pk=document_version_pk)
else:
document_version = get_object_or_404(Document, pk=document_id).latest_version
try:
#Test permissions and trigger exception
document.open()
# Test permissions and trigger exception
fd = document_version.open()
fd.close()
return serve_file(
request,
document.file,
save_as=u'"%s"' % document.get_fullname(),
content_type=document.file_mimetype if document.file_mimetype else 'application/octet-stream'
document_version.file,
save_as=u'"%s"' % document_version.filename,
content_type=document_version.mimetype if document_version.mimetype else 'application/octet-stream'
)
except Exception, e:
messages.error(request, e)
@@ -445,12 +458,11 @@ def _find_duplicate_list(request, source_document_list=Document.objects.all(), i
duplicated = []
for document in source_document_list:
if document.pk not in duplicated:
results = Document.objects.filter(checksum=document.checksum).exclude(id__in=duplicated).exclude(pk=document.pk).values_list('pk', flat=True)
results = DocumentVersion.objects.filter(checksum=document.latest_version.checksum).exclude(id__in=duplicated).exclude(pk=document.pk).values_list('document__pk', flat=True)
duplicated.extend(results)
if include_source and results:
duplicated.append(document.pk)
context = {
'object_list': Document.objects.filter(pk__in=duplicated),
'title': _(u'duplicated documents'),
@@ -471,6 +483,37 @@ def document_find_all_duplicates(request):
return _find_duplicate_list(request, include_source=True)
def document_update_page_count(request):
check_permissions(request.user, [PERMISSION_DOCUMENT_TOOLS])
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
office_converter = OfficeConverter()
qs = DocumentVersion.objects.exclude(filename__iendswith='dxf').filter(mimetype__in=office_converter.mimetypes())
if request.method == 'POST':
updated = 0
processed = 0
for document_version in qs:
old_page_count = document_version.pages.count()
document_version.update_page_count()
processed += 1
if old_page_count != document_version.pages.count():
updated += 1
messages.success(request, _(u'Page count update complete. Documents processed: %(total)d, documents with changed page count: %(change)d') % {
'total': processed,
'change': updated
})
return HttpResponseRedirect(previous)
return render_to_response('generic_confirm.html', {
'previous': previous,
'title': _(u'Are you sure you wish to update the page count for the office documents (%d)?') % qs.count(),
'message': _(u'On large databases this operation may take some time to execute.'),
'form_icon': u'page_white_csharp.png',
}, context_instance=RequestContext(request))
def document_clear_transformations(request, document_id=None, document_id_list=None):
check_permissions(request.user, [PERMISSION_DOCUMENT_TRANSFORM])
@@ -490,7 +533,7 @@ def document_clear_transformations(request, document_id=None, document_id_list=N
if request.method == 'POST':
for document in documents:
try:
for document_page in document.documentpage_set.all():
for document_page in document.pages.all():
document_page.document.invalidate_cached_image(document_page.page_number)
for transformation in document_page.documentpagetransformation_set.all():
transformation.delete()
@@ -626,11 +669,11 @@ def document_page_navigation_next(request, document_page_id):
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
if document_page.page_number >= document_page.document.documentpage_set.count():
if document_page.page_number >= document_page.siblings.count():
messages.warning(request, _(u'There are no more pages in this document'))
return HttpResponseRedirect(request.META.get('HTTP_REFERER', u'/'))
else:
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=document_page.page_number + 1)
document_page = get_object_or_404(document_page.siblings, page_number=document_page.page_number + 1)
return HttpResponseRedirect(reverse(view, args=[document_page.pk]))
@@ -643,7 +686,7 @@ def document_page_navigation_previous(request, document_page_id):
messages.warning(request, _(u'You are already at the first page of this document'))
return HttpResponseRedirect(request.META.get('HTTP_REFERER', u'/'))
else:
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=document_page.page_number - 1)
document_page = get_object_or_404(document_page.siblings, page_number=document_page.page_number - 1)
return HttpResponseRedirect(reverse(view, args=[document_page.pk]))
@@ -652,7 +695,7 @@ def document_page_navigation_first(request, document_page_id):
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=1)
document_page = get_object_or_404(document_page.siblings, page_number=1)
return HttpResponseRedirect(reverse(view, args=[document_page.pk]))
@@ -661,7 +704,7 @@ def document_page_navigation_last(request, document_page_id):
view = resolve_to_name(urlparse.urlparse(request.META.get('HTTP_REFERER', u'/')).path)
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
document_page = get_object_or_404(DocumentPage, document=document_page.document, page_number=document_page.document.documentpage_set.count())
document_page = get_object_or_404(document_page.siblings, page_number=document_page.siblings.count())
return HttpResponseRedirect(reverse(view, args=[document_page.pk]))
@@ -756,18 +799,18 @@ def document_print(request, document_id):
hard_copy_arguments['page_range'] = form.cleaned_data['page_range']
# Compute page width and height
if form.cleaned_data['custom_page_width'] and form.cleaned_data['custom_page_height']:
page_width = form.cleaned_data['custom_page_width']
page_height = form.cleaned_data['custom_page_height']
elif form.cleaned_data['page_size']:
page_width, page_height = dict(PAGE_SIZE_DIMENSIONS)[form.cleaned_data['page_size']]
#if form.cleaned_data['custom_page_width'] and form.cleaned_data['custom_page_height']:
# page_width = form.cleaned_data['custom_page_width']
# page_height = form.cleaned_data['custom_page_height']
#elif form.cleaned_data['page_size']:
# page_width, page_height = dict(PAGE_SIZE_DIMENSIONS)[form.cleaned_data['page_size']]
# Page orientation
if form.cleaned_data['page_orientation'] == PAGE_ORIENTATION_LANDSCAPE:
page_width, page_height = page_height, page_width
#if form.cleaned_data['page_orientation'] == PAGE_ORIENTATION_LANDSCAPE:
# page_width, page_height = page_height, page_width
hard_copy_arguments['page_width'] = page_width
hard_copy_arguments['page_height'] = page_height
#hard_copy_arguments['page_width'] = page_width
#hard_copy_arguments['page_height'] = page_height
new_url = [reverse('document_hard_copy', args=[document_id])]
if hard_copy_arguments:
@@ -815,9 +858,9 @@ def document_hard_copy(request, document_id):
if page_range:
page_range = parse_range(page_range)
pages = document.documentpage_set.filter(page_number__in=page_range)
pages = document.pages.filter(page_number__in=page_range)
else:
pages = document.documentpage_set.all()
pages = document.pages.all()
return render_to_response('document_print.html', {
'object': document,
@@ -1085,3 +1128,91 @@ def document_type_filename_create(request, document_type_id):
'document_type': document_type,
},
context_instance=RequestContext(request))
def document_clear_image_cache(request):
check_permissions(request.user, [PERMISSION_DOCUMENT_TOOLS])
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
if request.method == 'POST':
try:
Document.clear_image_cache()
messages.success(request, _(u'Document image cache cleared successfully'))
except Exception, msg:
messages.error(request, _(u'Error clearing document image cache; %s') % msg)
return HttpResponseRedirect(previous)
return render_to_response('generic_confirm.html', {
'previous': previous,
'title': _(u'Are you sure you wish to clear the document image cache?'),
'form_icon': u'camera_delete.png',
}, context_instance=RequestContext(request))
def document_version_list(request, document_pk):
check_permissions(request.user, [PERMISSION_DOCUMENT_VIEW])
document = get_object_or_404(Document, pk=document_pk)
RecentDocument.objects.add_document_for_user(request.user, document)
context = {
'object_list': document.versions.order_by('-timestamp'),
'title': _(u'versions for document: %s') % document,
'hide_object': True,
'object': document,
'extra_columns': [
{
'name': _(u'version'),
'attribute': 'get_formated_version',
},
{
'name': _(u'time and date'),
'attribute': 'timestamp',
},
{
'name': _(u'mimetype'),
'attribute': 'mimetype',
},
{
'name': _(u'encoding'),
'attribute': 'encoding',
},
{
'name': _(u'filename'),
'attribute': 'filename',
},
{
'name': _(u'comment'),
'attribute': 'comment',
},
]
}
return render_to_response('generic_list.html', context,
context_instance=RequestContext(request))
def document_version_revert(request, document_version_pk):
check_permissions(request.user, [PERMISSION_DOCUMENT_VERSION_REVERT])
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', '/')))
document_version = get_object_or_404(DocumentVersion, pk=document_version_pk)
if request.method == 'POST':
try:
document_version.revert()
messages.success(request, _(u'Document version reverted successfully'))
except Exception, msg:
messages.error(request, _(u'Error reverting document version; %s') % msg)
return HttpResponseRedirect(previous)
return render_to_response('generic_confirm.html', {
'previous': previous,
'object': document_version.document,
'title': _(u'Are you sure you wish to revert to this version?'),
'message': _(u'All later version after this one will be deleted too.'),
'form_icon': u'page_refresh.png',
}, context_instance=RequestContext(request))
+72 -9
View File
@@ -2,19 +2,82 @@ from django.utils.safestring import mark_safe
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from converter.literals import DEFAULT_ZOOM_LEVEL, DEFAULT_ROTATION, \
DEFAULT_PAGE_NUMBER
from converter.exceptions import UnknownFileFormat, UnkownConvertError
from mimetype.api import get_error_icon_url
from documents.conf.settings import DISPLAY_SIZE
def document_thumbnail(document):
try:
return mark_safe(u'<a class="fancybox" href="%(url)s"><img class="lazy-load" data-href="%(thumbnail)s" src="%(static_url)s/images/ajax-loader.gif" alt="%(string)s" /><noscript><img src="%(thumbnail)s" alt="%(string)s" /></noscript></a>' % {
'url': reverse('document_preview', args=[document.pk]),
'thumbnail': reverse('document_thumbnail', args=[document.pk]),
'static_url': settings.STATIC_URL,
'string': _(u'thumbnail')
})
except:
return u''
return document_html_widget(document, click_view='document_preview')
def document_link(document):
return mark_safe(u'<a href="%s">%s</a>' % (reverse('document_view_simple', args=[document.pk]), document))
def document_html_widget(document, view='document_thumbnail', click_view=None, page=DEFAULT_PAGE_NUMBER, zoom=DEFAULT_ZOOM_LEVEL, rotation=DEFAULT_ROTATION, gallery_name=None, fancybox_class='fancybox', version=None):
result = []
alt_text = _(u'document page image')
if not version:
version = document.latest_version.pk
query_dict = {
'page': page,
'zoom': zoom,
'rotation': rotation,
'version': version,
}
if gallery_name:
gallery_template = u'rel="%s"' % gallery_name
else:
gallery_template = u''
query_string = urlencode(query_dict)
preview_view = u'%s?%s' % (reverse(view, args=[document.pk]), query_string)
plain_template = []
plain_template.append(u'<img src="%s" alt="%s" />' % (preview_view, alt_text))
result.append(u'<div class="tc" id="document-%d-%d">' % (document.pk, page if page else 1))
if click_view:
result.append(u'<a %s class="%s" href="%s">' % (gallery_template, fancybox_class, u'%s?%s' % (reverse(click_view, args=[document.pk]), query_string)))
result.append(u'<img class="thin_border lazy-load" data-href="%s" src="%simages/ajax-loader.gif" alt="%s" />' % (preview_view, settings.STATIC_URL, alt_text))
result.append(u'<noscript><img style="border: 1px solid black;" src="%s" alt="%s" /></noscript>' % (preview_view, alt_text))
if click_view:
result.append(u'</a>')
result.append(u'</div>')
result.append(u'''
<script type="text/javascript">
$(document).ready(function() {
$.get('%(url)s', function(data) {})
.success(function(data) {
if (!data.result) {
$('#document-%(pk)d-%(page)d').html('%(plain_template)s');
}
})
.error(function(data) {
$('#document-%(pk)d-%(page)d').html('<img src="%(error_image)s" />');
});
});
</script>
''' % {
'url': reverse('documents-expensive-is_zoomable', args=[document.pk, version, page]),
'pk': document.pk,
'page': page if page else 1,
'plain_template': mark_safe(u''.join(plain_template)),
'error_image': u''.join([settings.STATIC_URL, get_error_icon_url()]),
}
)
return mark_safe(u''.join(result))
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-29 18:45-0400\n"
"POT-Creation-Date: 2011-11-22 11:26-0400\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"
@@ -33,27 +33,27 @@ msgstr ""
msgid "Search terms"
msgstr ""
#: models.py:18
#: models.py:20
msgid "user"
msgstr ""
#: models.py:19
#: models.py:21
msgid "query"
msgstr ""
#: models.py:20
#: models.py:22
msgid "datetime created"
msgstr ""
#: models.py:21
#: models.py:23
msgid "hits"
msgstr ""
#: models.py:59
#: models.py:61
msgid "recent search"
msgstr ""
#: models.py:60
#: models.py:62
msgid "recent searches"
msgstr ""

Some files were not shown because too many files have changed in this diff Show More