summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_context_records/views.py3
-rw-r--r--archaeological_context_records/wizards.py6
-rw-r--r--archaeological_files/views.py2
-rw-r--r--archaeological_files/wizards.py6
-rw-r--r--archaeological_finds/views.py7
-rw-r--r--archaeological_finds/wizards.py14
-rw-r--r--archaeological_warehouse/views.py5
-rw-r--r--archaeological_warehouse/wizards.py10
-rw-r--r--ishtar_common/views.py6
-rw-r--r--ishtar_common/wizards.py14
10 files changed, 55 insertions, 18 deletions
diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py
index 3fd393a4d..6966c81e6 100644
--- a/archaeological_context_records/views.py
+++ b/archaeological_context_records/views.py
@@ -33,7 +33,6 @@ from ishtar_common.utils import put_session_message
from ishtar_common.views import IshtarMixin, LoginRequiredMixin
from ishtar_common.views_item import display_item, get_item, show_item, \
revert_item
-from ishtar_common.wizards import SearchWizard
from wizards import *
show_contextrecord = show_item(
@@ -91,7 +90,7 @@ get_contextrecordrelationdetail = get_item(
models.RecordRelations, 'get_contextrecordrelationdetail',
'contextrecordrelationdetail', specific_perms=['view_recordrelation'])
-record_search_wizard = SearchWizard.as_view([
+record_search_wizard = RecordSearch.as_view([
('general-record_search', RecordFormSelection)],
label=_(u"Context record search"),
url_name='record_search',)
diff --git a/archaeological_context_records/wizards.py b/archaeological_context_records/wizards.py
index 89750794c..327aedb5b 100644
--- a/archaeological_context_records/wizards.py
+++ b/archaeological_context_records/wizards.py
@@ -22,7 +22,11 @@ from django.utils.translation import ugettext_lazy as _
import models
from ishtar_common.forms import reverse_lazy
-from ishtar_common.wizards import Wizard, DeletionWizard
+from ishtar_common.wizards import Wizard, DeletionWizard, SearchWizard
+
+
+class RecordSearch(SearchWizard):
+ model = models.ContextRecord
class RecordWizard(Wizard):
diff --git a/archaeological_files/views.py b/archaeological_files/views.py
index 1ca8d41ac..9db2514af 100644
--- a/archaeological_files/views.py
+++ b/archaeological_files/views.py
@@ -100,7 +100,7 @@ def dashboard_file(request, *args, **kwargs):
dct = {'dashboard': models.FileDashboard()}
return render(request, 'ishtar/dashboards/dashboard_file.html', dct)
-file_search_wizard = SearchWizard.as_view(
+file_search_wizard = FileSearch.as_view(
[('general-file_search', FileFormSelection)],
label=_(u"File search"), url_name='file_search',)
diff --git a/archaeological_files/wizards.py b/archaeological_files/wizards.py
index 7fdb5e8ff..106008192 100644
--- a/archaeological_files/wizards.py
+++ b/archaeological_files/wizards.py
@@ -24,7 +24,7 @@ from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from ishtar_common.forms import reverse_lazy
-from ishtar_common.wizards import ClosingWizard
+from ishtar_common.wizards import ClosingWizard, SearchWizard
from archaeological_operations.wizards import OperationWizard,\
OperationAdministrativeActWizard
from archaeological_operations.models import AdministrativeAct, Parcel, \
@@ -32,6 +32,10 @@ from archaeological_operations.models import AdministrativeAct, Parcel, \
import models
+class FileSearch(SearchWizard):
+ model = models.File
+
+
class FileWizard(OperationWizard):
model = models.File
object_parcel_type = 'associated_file'
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 76f1977e6..6c6d9fff9 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -38,7 +38,6 @@ from ishtar_common.views import get_autocomplete_generic, IshtarMixin, \
LoginRequiredMixin
from ishtar_common.views_item import display_item, get_item, show_item, \
revert_item, get_autocomplete_item
-from ishtar_common.wizards import SearchWizard
from wizards import *
get_find = get_item(models.Find, 'get_find', 'find')
@@ -150,7 +149,7 @@ find_search_condition_dict = {
'generalwarehouse-find_search': check_warehouse_module,
}
-find_search_wizard = SearchWizard.as_view([
+find_search_wizard = FindSearch.as_view([
('general-find_search', FindFormSelection),
('generalwarehouse-find_search', FindFormSelectionWarehouseModule)],
label=_(u"Find search"),
@@ -378,7 +377,7 @@ treatment_wizard_steps = [
]
-treatment_search_wizard = SearchWizard.as_view([
+treatment_search_wizard = TreatmentSearch.as_view([
('general-treatment_search', TreatmentFormSelection)],
label=_(u"Treatment search"),
url_name='treatment_search',)
@@ -482,7 +481,7 @@ def treatment_administrativeacttreatment_modify(request, pk):
# treatment request
-treatmentfile_search_wizard = SearchWizard.as_view([
+treatmentfile_search_wizard = TreatmentFileSearch.as_view([
('general-treatmentfile_search', TreatmentFileFormSelection)],
label=_(u"Treatment request search"),
url_name='treatmentfile_search',)
diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py
index b15948dce..6486e5da1 100644
--- a/archaeological_finds/wizards.py
+++ b/archaeological_finds/wizards.py
@@ -21,7 +21,7 @@ from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from django.utils.translation import ugettext_lazy as _
from ishtar_common.forms import reverse_lazy
-from ishtar_common.wizards import Wizard, DeletionWizard, SourceWizard
+from ishtar_common.wizards import Wizard, DeletionWizard, SearchWizard
from archaeological_operations.wizards import OperationAdministrativeActWizard
from archaeological_operations.models import AdministrativeAct
@@ -29,6 +29,10 @@ from archaeological_context_records.models import ContextRecord
import models
+class FindSearch(SearchWizard):
+ model = models.Find
+
+
class FindWizard(Wizard):
model = models.Find
wizard_done_window = reverse_lazy('show-find')
@@ -98,6 +102,10 @@ class FindDeletionWizard(DeletionWizard):
'comment']
+class TreatmentSearch(SearchWizard):
+ model = models.Treatment
+
+
class TreatmentWizard(Wizard):
model = models.Treatment
wizard_done_window = reverse_lazy('show-treatment')
@@ -162,6 +170,10 @@ class TreatmentEditAdministrativeActWizard(TreatmentAdministrativeActWizard):
return self.get_current_object().treatment
+class TreatmentFileSearch(SearchWizard):
+ model = models.TreatmentFile
+
+
class TreatmentFileWizard(Wizard):
model = models.TreatmentFile
wizard_done_window = reverse_lazy('show-treatmentfile')
diff --git a/archaeological_warehouse/views.py b/archaeological_warehouse/views.py
index ec160cbce..a1b1ffbe2 100644
--- a/archaeological_warehouse/views.py
+++ b/archaeological_warehouse/views.py
@@ -27,7 +27,6 @@ from django.utils.translation import ugettext_lazy as _
from forms import *
from ishtar_common.views_item import get_item, show_item, new_item
-from ishtar_common.wizards import SearchWizard
from wizards import *
get_container = get_item(models.Container, 'get_container', 'container')
@@ -92,7 +91,7 @@ warehouse_packaging_wizard = PackagingWizard.as_view([
label=_(u"Packaging"),
url_name='warehouse_packaging',)
-warehouse_search_wizard = SearchWizard.as_view([
+warehouse_search_wizard = WarehouseSearch.as_view([
('selec-warehouse_search', WarehouseFormSelection)],
label=_(u"Warehouse search"),
url_name='warehouse_search',
@@ -134,7 +133,7 @@ warehouse_deletion_wizard = WarehouseDeletionWizard.as_view([
label=_(u"Warehouse deletion"),
url_name='warehouse_deletion',)
-container_search_wizard = SearchWizard.as_view([
+container_search_wizard = ContainerWizard.as_view([
('selec-container_search', MainContainerFormSelection)],
label=_(u"Container search"),
url_name='container_search',
diff --git a/archaeological_warehouse/wizards.py b/archaeological_warehouse/wizards.py
index 6678e6c36..41c5c5945 100644
--- a/archaeological_warehouse/wizards.py
+++ b/archaeological_warehouse/wizards.py
@@ -20,13 +20,21 @@
from django.shortcuts import render
from ishtar_common.forms import reverse_lazy
-from ishtar_common.wizards import Wizard, DeletionWizard
+from ishtar_common.wizards import Wizard, DeletionWizard, SearchWizard
from archaeological_finds.wizards import TreatmentWizard
from archaeological_finds.models import Treatment, TreatmentType
import models
+class WarehouseSearch(SearchWizard):
+ model = models.Warehouse
+
+
+class ContainerSearch(SearchWizard):
+ model = models.Container
+
+
class PackagingWizard(TreatmentWizard):
basket_step = 'base-packaging'
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index c713b9972..54af31cff 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -101,7 +101,7 @@ def index(request):
logout(request)
return render(request, 'index.html', dct)
-person_search_wizard = wizards.SearchWizard.as_view(
+person_search_wizard = wizards.PersonWizard.as_view(
[('general-person_search', forms.PersonFormSelection)],
label=_(u"Person search"),
url_name='person_search',)
@@ -136,7 +136,7 @@ person_deletion_wizard = wizards.PersonDeletionWizard.as_view(
label=_(u"Person deletion"),
url_name='person_deletion',)
-organization_search_wizard = wizards.SearchWizard.as_view(
+organization_search_wizard = wizards.OrganizationSearch.as_view(
[('general-organization_search', forms.OrganizationFormSelection)],
label=_(u"Organization search"),
url_name='organization_search',)
@@ -1593,7 +1593,7 @@ get_document = get_item(models.Document, 'get_document', 'document')
display_document = display_item(models.Document)
-document_search_wizard = wizards.SearchWizard.as_view(
+document_search_wizard = wizards.DocumentSearch.as_view(
[('selec-document_search', forms.DocumentFormSelection)],
label=_(u"Document: search"),
url_name='search-document',
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index 9a068063b..62bafdfe4 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -1424,7 +1424,7 @@ class SearchWizard(IshtarWizard):
current_step = self.steps.current
bookmark = self.request.GET.get('bookmark', None)
default_search_vector = None
- if bookmark:
+ if bookmark and self.model:
try:
app_label = self.model.__module__.split('.')[0]
sq = models.SearchQuery.objects.get(
@@ -1444,6 +1444,18 @@ class SearchWizard(IshtarWizard):
return context
+class PersonSearch(SearchWizard):
+ model = models.Person
+
+
+class OrganizationSearch(SearchWizard):
+ model = models.Organization
+
+
+class DocumentSearch(SearchWizard):
+ model = models.Document
+
+
class DeletionWizard(Wizard):
def __init__(self, *args, **kwargs):
if (not hasattr(self, 'fields') or not self.fields) and \