diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-21 12:10:33 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-10-21 12:10:33 +0200 |
commit | 82fa5eed0e7a25b93c56c97011d454e595665b65 (patch) | |
tree | 6b7e2817d02157e792adaf773b7c12a1c732b844 | |
parent | ec49fcefb6e63eb7efb1bca59a1fc717769438c4 (diff) | |
download | Ishtar-82fa5eed0e7a25b93c56c97011d454e595665b65.tar.bz2 Ishtar-82fa5eed0e7a25b93c56c97011d454e595665b65.zip |
Search: manage string definition for associated models
-rw-r--r-- | archaeological_operations/models.py | 2 | ||||
-rw-r--r-- | ishtar_common/views.py | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index ce804765d..ac64c474f 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -890,7 +890,7 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): # search parameters DATED_FIELDS = ['signature_date__lte', 'signature_date__gte'] ASSOCIATED_MODELS = [ - (models.File, 'associated_file'), + ('File', 'associated_file'), (Person, 'associated_file__general_contractor')] EXTRA_REQUEST_KEYS = { 'act_object': 'act_object__icontains', diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 4ee8da963..bc5e5ef1d 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -614,6 +614,10 @@ def get_item(model, func_name, default_name, extra_request_keys=[], or '')) for field in fields]) for associated_model, key in my_associated_models: + if type(associated_model) in (str, unicode): + if associated_model not in globals(): + continue + associated_model = globals()[associated_model] associated_fields = [ associated_model._meta.get_field_by_name(k)[0] for k in associated_model._meta.get_all_field_names()] |