summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-10-07 19:09:30 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:21 +0100
commit9d5f0791187ff6b18d3ffa4db4d593fe96834e8d (patch)
tree9cd21bf7e51d271b958a9a4b2b85367adbb97992 /archaeological_finds
parente5c0a159929fc64d63db37ebd85a5a810faf2534 (diff)
downloadIshtar-9d5f0791187ff6b18d3ffa4db4d593fe96834e8d.tar.bz2
Ishtar-9d5f0791187ff6b18d3ffa4db4d593fe96834e8d.zip
Refactoring of models. Document container - declare only id
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models_finds.py6
-rw-r--r--archaeological_finds/models_treatments.py3
-rw-r--r--archaeological_finds/tests.py6
3 files changed, 9 insertions, 6 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 2faf97d1d..77fe44da5 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -41,11 +41,13 @@ from ishtar_common.alternative_configs import ALTERNATE_CONFIGS
from ishtar_common.model_managers import ExternalIdManager, UUIDModelManager
from ishtar_common.models import Document, GeneralType, \
HierarchicalType, BaseHistorizedItem, LightHistorizedItem, \
- HistoricalRecords, OwnPerms, Person, Basket, post_save_cache, \
- ValueGetter, get_current_profile, IshtarSiteProfile, PRIVATE_FIELDS, \
+ OwnPerms, Person, Basket, post_save_cache, \
+ ValueGetter, get_current_profile, IshtarSiteProfile, \
GeoItem, BulkUpdatedItem, QuickAction, \
MainItem, document_attached_changed, HistoryModel, DynamicRequest, \
SearchAltName, QRCodeItem, SearchVectorConfig, DocumentItem
+from ishtar_common.models_common import HistoricalRecords
+from ishtar_common.utils import PRIVATE_FIELDS
from archaeological_operations.models import AdministrativeAct, Operation, \
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index a7af1117e..073083af4 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -35,10 +35,11 @@ from archaeological_context_records.models import Dating
from archaeological_warehouse.models import Warehouse, Container
from ishtar_common.model_managers import ExternalIdManager
from ishtar_common.models import Document, GeneralType, \
- ImageModel, BaseHistorizedItem, OwnPerms, HistoricalRecords, Person, \
+ ImageModel, BaseHistorizedItem, OwnPerms, Person, \
Organization, ValueGetter, post_save_cache, ShortMenuItem, \
DashboardFormItem, document_attached_changed, \
HistoryModel, SearchAltName, SearchVectorConfig, DocumentItem
+from ishtar_common.models_common import HistoricalRecords
from ishtar_common.utils import cached_label_changed, get_current_year, \
update_data, m2m_historization_changed
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index 35471df00..f3d54ae49 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -1156,7 +1156,7 @@ class FindSearchTest(FindInit, TestCase, SearchText):
find.conservatory_state = cs2
find.save()
- search = {'conservatory_state': cs2.pk}
+ search = {'search_vector': f'conservatory="{cs2.name}"'}
# no result when no authentication
response = c.get(reverse('get-find'), search)
@@ -1171,14 +1171,14 @@ class FindSearchTest(FindInit, TestCase, SearchText):
self.assertEqual(json.loads(content)['recordsTotal'], 1)
# no result for the brother
- search = {'conservatory_state': cs3.pk}
+ search = {'search_vector': f'conservatory="{cs3.name}"'}
response = c.get(reverse('get-find'), search)
self.assertEqual(response.status_code, 200)
content = response.content.decode()
self.assertEqual(json.loads(content)['recordsTotal'], 0)
# one result for the father
- search = {'conservatory_state': cs1.pk}
+ search = {'search_vector': f'conservatory="{cs1.name}"'}
response = c.get(reverse('get-find'), search)
self.assertEqual(response.status_code, 200)
content = response.content.decode()