# HG changeset patch # User ymh # Date 1529711976 -7200 # Node ID f19bef104a7701e4978a79e1aa9b180fea0f7ea0 # Parent 59d7cb99f4df41915a7de4ec137973c484df74b6 change item natural key def to include the collection name diff -r 59d7cb99f4df -r f19bef104a77 src/iconolab/__init__.py --- a/src/iconolab/__init__.py Fri Jun 22 11:33:17 2018 +0200 +++ b/src/iconolab/__init__.py Sat Jun 23 01:59:36 2018 +0200 @@ -1,4 +1,4 @@ -VERSION = (0, 1, 0, "final", 0) +VERSION = (0, 1, 1, "final", 0) VERSION_STR = ".".join(map(lambda i:"%02d" % (i,), VERSION[:2])) diff -r 59d7cb99f4df -r f19bef104a77 src/iconolab/migrations/0029_auto_itemmetadata_metadata_data.py --- a/src/iconolab/migrations/0029_auto_itemmetadata_metadata_data.py Fri Jun 22 11:33:17 2018 +0200 +++ b/src/iconolab/migrations/0029_auto_itemmetadata_metadata_data.py Sat Jun 23 01:59:36 2018 +0200 @@ -25,7 +25,7 @@ } item_metadata.metadata = json.dumps(new_metadata) - item_metadata.natural_key = item_metadata.joconde_ref + item_metadata.natural_key = "%s|%s" % (item_metadata.collection.name, item_metadata.joconde_ref) item_metadata.save() class Migration(migrations.Migration): diff -r 59d7cb99f4df -r f19bef104a77 src/iconolab/models.py --- a/src/iconolab/models.py Fri Jun 22 11:33:17 2018 +0200 +++ b/src/iconolab/models.py Sat Jun 23 01:59:36 2018 +0200 @@ -136,11 +136,14 @@ def __init__(self, *args, **kwargs): self.__metadata_obj = None + self.__raw_natural_key = None super().__init__(*args, **kwargs) def __setattr__(self, name, value): if name == 'metadata': self.__metadata_obj = None + elif name == 'natural_key' + self.__raw_natural_key = None return super().__setattr__(name, value) @property @@ -149,6 +152,12 @@ self.__metadata_obj = json.loads(self.metadata) return self.__metadata_obj + @property + def raw_natural_key(self): + if self.__raw_natural_key is None: + self.__raw_natural_key = (self.natural_key or "").split("|")[-1] + return self.__raw_natural_key + def __str__(self): return "metadatas:for:" + str(self.item.item_guid) diff -r 59d7cb99f4df -r f19bef104a77 src/iconolab/templates/partials/header_breadcrumbs.html --- a/src/iconolab/templates/partials/header_breadcrumbs.html Fri Jun 22 11:33:17 2018 +0200 +++ b/src/iconolab/templates/partials/header_breadcrumbs.html Sat Jun 23 01:59:36 2018 +0200 @@ -6,9 +6,9 @@ {% else %}
  • Fond {{collection.verbose_name}}
  • {% if not annotation %} -
  • Objet {{ item.metadatas.natural_key }}
  • +
  • Objet {{ item.metadatas.raw_natural_key }}
  • {% else %} -
  • Objet {{ image.item.metadatas.natural_key }}
  • +
  • Objet {{ image.item.metadatas.raw_natural_key }}
  • {% if not revision %}
  • Annotation
  • {% else %}