summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/fixtures/initial_data-fr.json238
-rw-r--r--ishtar_common/fixtures/initial_importtypes-fr.json554
-rw-r--r--ishtar_common/models.py17
-rw-r--r--ishtar_common/views.py5
4 files changed, 773 insertions, 41 deletions
diff --git a/ishtar_common/fixtures/initial_data-fr.json b/ishtar_common/fixtures/initial_data-fr.json
index 54b0c5d7b..9255c604e 100644
--- a/ishtar_common/fixtures/initial_data-fr.json
+++ b/ishtar_common/fixtures/initial_data-fr.json
@@ -36,10 +36,27 @@
"pk": 7,
"model": "ishtar_common.persontype",
"fields": {
- "comment": "Un acc\u00e8s limit\u00e9 \u00e0 la base, uniquement en lecture. Apr\u00e8s enregistrement.",
+ "comment": "Un acc\u00e8s limit\u00e9 - uniquement en lecture - \u00e0 la totalit\u00e9 de la base, apr\u00e8s enregistrement.",
"available": true,
"txt_idx": "reader_access",
- "groups": [],
+ "groups": [
+ 1,
+ 66,
+ 4,
+ 5,
+ 6,
+ 33,
+ 8,
+ 73,
+ 7,
+ 2,
+ 79,
+ 72,
+ 85,
+ 25,
+ 93,
+ 30
+ ],
"label": "Acc\u00e8s en lecture"
}
},
@@ -50,7 +67,103 @@
"comment": "",
"available": true,
"txt_idx": "administrator",
- "groups": [],
+ "groups": [
+ 1,
+ 2,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 20,
+ 21,
+ 22,
+ 23,
+ 24,
+ 25,
+ 26,
+ 27,
+ 28,
+ 29,
+ 30,
+ 31,
+ 32,
+ 33,
+ 34,
+ 35,
+ 36,
+ 37,
+ 38,
+ 39,
+ 40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 46,
+ 47,
+ 48,
+ 49,
+ 50,
+ 51,
+ 52,
+ 53,
+ 54,
+ 55,
+ 56,
+ 57,
+ 58,
+ 59,
+ 60,
+ 61,
+ 62,
+ 63,
+ 64,
+ 65,
+ 66,
+ 67,
+ 68,
+ 69,
+ 70,
+ 71,
+ 72,
+ 73,
+ 74,
+ 75,
+ 76,
+ 77,
+ 78,
+ 79,
+ 80,
+ 81,
+ 82,
+ 83,
+ 84,
+ 85,
+ 86,
+ 87,
+ 88,
+ 89,
+ 90,
+ 93,
+ 94,
+ 95,
+ 96,
+ 97,
+ 98
+ ],
"label": "Administrateur"
}
},
@@ -83,7 +196,28 @@
"comment": "Peut intervenir sur les donn\u00e9es d'une op\u00e9ration sans en \u00eatre responsable.",
"available": true,
"txt_idx": "collaborator",
- "groups": [],
+ "groups": [
+ 51,
+ 70,
+ 71,
+ 72,
+ 41,
+ 74,
+ 77,
+ 46,
+ 47,
+ 48,
+ 40,
+ 82,
+ 83,
+ 84,
+ 78,
+ 58,
+ 59,
+ 60,
+ 42,
+ 63
+ ],
"label": "Collaborateur scientifique"
}
},
@@ -105,7 +239,40 @@
"comment": "Peut g\u00e9rer du mobilier qu'il n'a pas cr\u00e9\u00e9.\r\n\r\n",
"available": true,
"txt_idx": "warehouse_manager",
- "groups": [],
+ "groups": [
+ 1,
+ 2,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 11,
+ 12,
+ 15,
+ 16,
+ 19,
+ 20,
+ 25,
+ 30,
+ 33,
+ 64,
+ 65,
+ 66,
+ 70,
+ 71,
+ 72,
+ 73,
+ 79,
+ 80,
+ 81,
+ 85,
+ 86,
+ 87,
+ 93,
+ 94,
+ 95
+ ],
"label": "Gestionnaire de d\u00e9p\u00f4t"
}
},
@@ -117,16 +284,12 @@
"available": true,
"txt_idx": "sra_agent",
"groups": [
- 30,
- 31,
- 32,
- 2,
1,
+ 2,
4,
- 3,
5,
- 7,
6,
+ 7,
8,
9,
10,
@@ -144,7 +307,23 @@
26,
27,
28,
- 29
+ 29,
+ 30,
+ 31,
+ 32,
+ 33,
+ 66,
+ 70,
+ 71,
+ 72,
+ 73,
+ 75,
+ 76,
+ 79,
+ 80,
+ 81,
+ 85,
+ 93
],
"label": "Responsable de suivi scientifique"
}
@@ -156,7 +335,29 @@
"comment": "Responsable d'op\u00e9ration arch\u00e9ologique.",
"available": true,
"txt_idx": "head_scientist",
- "groups": [],
+ "groups": [
+ 1,
+ 50,
+ 70,
+ 71,
+ 72,
+ 41,
+ 74,
+ 77,
+ 46,
+ 47,
+ 48,
+ 40,
+ 82,
+ 83,
+ 84,
+ 78,
+ 58,
+ 59,
+ 60,
+ 42,
+ 63
+ ],
"label": "Responsable scientifique"
}
},
@@ -185,7 +386,16 @@
26,
27,
28,
- 29
+ 29,
+ 30,
+ 31,
+ 32,
+ 33,
+ 70,
+ 71,
+ 72,
+ 73,
+ 79
],
"label": "Secr\u00e9tariat"
}
diff --git a/ishtar_common/fixtures/initial_importtypes-fr.json b/ishtar_common/fixtures/initial_importtypes-fr.json
index 511a1fc7d..115f6a985 100644
--- a/ishtar_common/fixtures/initial_importtypes-fr.json
+++ b/ishtar_common/fixtures/initial_importtypes-fr.json
@@ -1,5 +1,13 @@
[
{
+ "pk": 17,
+ "model": "ishtar_common.importermodel",
+ "fields": {
+ "name": "Auteur",
+ "klass": "ishtar_common.models.Author"
+ }
+ },
+ {
"pk": 11,
"model": "ishtar_common.importermodel",
"fields": {
@@ -8,6 +16,22 @@
}
},
{
+ "pk": 16,
+ "model": "ishtar_common.importermodel",
+ "fields": {
+ "name": "Documentation de demande de traitement",
+ "klass": "archaeological_finds.models_treatments.TreatmentFileSource"
+ }
+ },
+ {
+ "pk": 15,
+ "model": "ishtar_common.importermodel",
+ "fields": {
+ "name": "Documentation de traitement",
+ "klass": "archaeological_finds.models_treatments.TreatmentSource"
+ }
+ },
+ {
"pk": 8,
"model": "ishtar_common.importermodel",
"fields": {
@@ -16,6 +40,22 @@
}
},
{
+ "pk": 13,
+ "model": "ishtar_common.importermodel",
+ "fields": {
+ "name": "Documentation d'UE",
+ "klass": "archaeological_context_records.models.ContextRecordSource"
+ }
+ },
+ {
+ "pk": 14,
+ "model": "ishtar_common.importermodel",
+ "fields": {
+ "name": "Documentation mobilier",
+ "klass": "archaeological_finds.models_finds.FindSource"
+ }
+ },
+ {
"pk": 2,
"model": "ishtar_common.importermodel",
"fields": {
@@ -124,6 +164,24 @@
}
},
{
+ "pk": 22,
+ "model": "ishtar_common.importertype",
+ "fields": {
+ "description": "Documentation d'op\u00e9ration",
+ "created_models": [
+ 17,
+ 8,
+ 5
+ ],
+ "is_template": true,
+ "unicity_keys": "external_id",
+ "users": [],
+ "slug": "ishtar-operations-sources",
+ "associated_models": 8,
+ "name": "Ishtar - Op\u00e9rations - Documentation"
+ }
+ },
+ {
"pk": 19,
"model": "ishtar_common.importertype",
"fields": {
@@ -287,6 +345,14 @@
}
},
{
+ "pk": 25,
+ "model": "ishtar_common.importerdefault",
+ "fields": {
+ "importer_type": 22,
+ "target": "authors"
+ }
+ },
+ {
"pk": 26,
"model": "ishtar_common.importerdefaultvalues",
"fields": {
@@ -332,6 +398,15 @@
}
},
{
+ "pk": 31,
+ "model": "ishtar_common.importerdefaultvalues",
+ "fields": {
+ "default_target": 25,
+ "target": "author_type",
+ "value": "main_author"
+ }
+ },
+ {
"pk": 336,
"model": "ishtar_common.importercolumn",
"fields": {
@@ -1307,6 +1382,201 @@
}
},
{
+ "pk": 376,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 1,
+ "description": "Code UNIQUE pour une op\u00e9ration (par exemple : code PATRIARCHE)",
+ "regexp_pre_filter": null,
+ "required": true,
+ "label": "Code op\u00e9ration",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 379,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 2,
+ "description": "Num\u00e9ro unique par op\u00e9ration",
+ "regexp_pre_filter": null,
+ "required": true,
+ "label": "Index (num\u00e9ro par op\u00e9ration)",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 378,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 3,
+ "description": "",
+ "regexp_pre_filter": null,
+ "required": true,
+ "label": "Type de document",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 377,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 4,
+ "description": "Titre du document (max. 300 caract\u00e8res)",
+ "regexp_pre_filter": null,
+ "required": true,
+ "label": "Titre",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 380,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 5,
+ "description": "R\u00e9f\u00e9rence libre (max. 100 caract\u00e8res)",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "R\u00e9f\u00e9rence",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 381,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 6,
+ "description": "R\u00e9f\u00e9rence interne libre (max. 100 caract\u00e8res)",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "R\u00e9f\u00e9rence interne",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 382,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 7,
+ "description": "Adresse web compl\u00e8te (avec la partie http:// ou https://)",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Adresse web associ\u00e9e",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 383,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 8,
+ "description": "Date de r\u00e9ception (format JJ/MM/AAAA ou AAAA-MM-JJ)",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Date de r\u00e9ception",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 384,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 9,
+ "description": "Date de cr\u00e9ation (format JJ/MM/AAAA ou AAAA-MM-JJ)",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Date de cr\u00e9ation",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 385,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 10,
+ "description": "Date de r\u00e9ception en documentation (format JJ/MM/AAAA ou AAAA-MM-JJ)",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Date de r\u00e9ception en documentation",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 386,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 11,
+ "description": "Texte libre",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Commentaire",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 387,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 12,
+ "description": "Texte libre",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Description",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 388,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 13,
+ "description": "Texte libre",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Information suppl\u00e9mentaire",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 390,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 14,
+ "description": "",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Existe en doublon",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
+ "pk": 389,
+ "model": "ishtar_common.importercolumn",
+ "fields": {
+ "col_number": 15,
+ "description": "Nom (en casse haute) suivi du pr\u00e9nom de l'auteur (maximum 300 caract\u00e8res). Exemple : DUPONT Jean.",
+ "regexp_pre_filter": null,
+ "required": false,
+ "label": "Auteur principal",
+ "importer_type": 22,
+ "export_field_name": ""
+ }
+ },
+ {
"pk": 303,
"model": "ishtar_common.importercolumn",
"fields": {
@@ -1623,12 +1893,12 @@
"model": "ishtar_common.importercolumn",
"fields": {
"col_number": 14,
- "description": "Contient ou non du mobilier (oui/non).",
+ "description": "Champ \u00e0 choix multiple (s\u00e9par\u00e9 par \u00ab & \u00bb) permettant de pr\u00e9ciser : contient du mobilier, dispose d'une photo, etc.",
"regexp_pre_filter": null,
"required": false,
- "label": "Contient du mobilier",
+ "label": "Documentations",
"importer_type": 18,
- "export_field_name": null
+ "export_field_name": ""
}
},
{
@@ -3692,20 +3962,6 @@
}
},
{
- "pk": 348,
- "model": "ishtar_common.importtarget",
- "fields": {
- "comment": "",
- "target": "has_furniture",
- "column": 323,
- "formater_type": 19,
- "concat_str": "",
- "regexp_filter": null,
- "concat": false,
- "force_new": false
- }
- },
- {
"pk": 351,
"model": "ishtar_common.importtarget",
"fields": {
@@ -4098,6 +4354,20 @@
}
},
{
+ "pk": 348,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "documentations",
+ "column": 323,
+ "formater_type": 52,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
"pk": 395,
"model": "ishtar_common.importtarget",
"fields": {
@@ -4308,6 +4578,104 @@
}
},
{
+ "pk": 402,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "title",
+ "column": 377,
+ "formater_type": 4,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 404,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "index",
+ "column": 379,
+ "formater_type": 1,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 406,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "internal_reference",
+ "column": 381,
+ "formater_type": 51,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 408,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "receipt_date",
+ "column": 383,
+ "formater_type": 25,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 410,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "receipt_date_in_documentation",
+ "column": 385,
+ "formater_type": 25,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 412,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "description",
+ "column": 387,
+ "formater_type": 35,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 414,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "authors__person__raw_name",
+ "column": 389,
+ "formater_type": 4,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
"pk": 396,
"model": "ishtar_common.importtarget",
"fields": {
@@ -4588,6 +4956,104 @@
}
},
{
+ "pk": 403,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "source_type",
+ "column": 378,
+ "formater_type": 12,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 401,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "operation__code_patriarche",
+ "column": 376,
+ "formater_type": 35,
+ "concat_str": "-",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 405,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "reference",
+ "column": 380,
+ "formater_type": 51,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 407,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "associated_url",
+ "column": 382,
+ "formater_type": 4,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 409,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "creation_date",
+ "column": 384,
+ "formater_type": 25,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 411,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "comment",
+ "column": 386,
+ "formater_type": 35,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 413,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "additional_information",
+ "column": 388,
+ "formater_type": 35,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
"pk": 295,
"model": "ishtar_common.importtarget",
"fields": {
@@ -4602,6 +5068,20 @@
}
},
{
+ "pk": 415,
+ "model": "ishtar_common.importtarget",
+ "fields": {
+ "comment": "",
+ "target": "duplicate",
+ "column": 390,
+ "formater_type": 19,
+ "concat_str": "",
+ "regexp_filter": null,
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
"pk": 310,
"model": "ishtar_common.importtarget",
"fields": {
@@ -4931,6 +5411,15 @@
}
},
{
+ "pk": 52,
+ "model": "ishtar_common.formatertype",
+ "fields": {
+ "formater_type": "TypeFormater",
+ "many_split": "&",
+ "options": "archaeological_context_records.models.DocumentationType"
+ }
+ },
+ {
"pk": 24,
"model": "ishtar_common.formatertype",
"fields": {
@@ -5147,6 +5636,15 @@
}
},
{
+ "pk": 51,
+ "model": "ishtar_common.formatertype",
+ "fields": {
+ "formater_type": "UnicodeFormater",
+ "many_split": "",
+ "options": "100"
+ }
+ },
+ {
"pk": 16,
"model": "ishtar_common.formatertype",
"fields": {
@@ -5738,5 +6236,27 @@
"concat": false,
"force_new": false
}
+ },
+ {
+ "pk": 52,
+ "model": "ishtar_common.importerduplicatefield",
+ "fields": {
+ "column": 376,
+ "concat_str": "-",
+ "field_name": "external_id",
+ "concat": false,
+ "force_new": false
+ }
+ },
+ {
+ "pk": 53,
+ "model": "ishtar_common.importerduplicatefield",
+ "fields": {
+ "column": 379,
+ "concat_str": "-",
+ "field_name": "external_id",
+ "concat": false,
+ "force_new": false
+ }
}
] \ No newline at end of file
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 5c84447a4..e49044cfd 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -2464,20 +2464,21 @@ class Import(models.Model):
tmpdir = tempfile.mkdtemp(prefix='tmp-ishtar-')
imported_file = z.extract(filename, tmpdir)
- with open(imported_file) as csv_file:
- encodings = [self.encoding]
- encodings += [coding for coding, c in ENCODINGS]
- for encoding in encodings:
- try:
+ encodings = [self.encoding]
+ encodings += [coding for coding, c in ENCODINGS
+ if coding != self.encoding]
+ for encoding in encodings:
+ try:
+ with open(imported_file) as csv_file:
vals = [line
for line in unicodecsv.reader(csv_file,
encoding=encoding)]
if tmpdir:
shutil.rmtree(tmpdir)
+ print(encoding, imported_file, vals[0])
return vals
- except UnicodeDecodeError:
- if encoding != encodings[-1]:
- csv_file.seek(0)
+ except UnicodeDecodeError:
+ print(encoding, encodings)
if tmpdir:
shutil.rmtree(tmpdir)
return []
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 5786391cc..86c87d049 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -1635,8 +1635,9 @@ class DisplayItemView(IshtarMixin, LoginRequiredMixin, TemplateView):
def get_context_data(self, *args, **kwargs):
data = super(DisplayItemView, self).get_context_data(*args, **kwargs)
- data['pk'] = unicode(kwargs.get('pk')) + '/'
- data['item_url'] = 'show-' + kwargs.get('item_type')
+ pk = unicode(kwargs.get('pk')) + '/'
+ item_url = '/show-' + kwargs.get('item_type')
+ data['show_url'] = item_url + "/" + pk
return data