summaryrefslogtreecommitdiff
path: root/archaeological_context_records/views.py
blob: b1f8ca772a8b5466185d737ede836fa3c377362b (plain)
1
2
3
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2012  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet>

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# See the file COPYING for details.

from ishtar_common.views import get_item, show_item, revert_item
from ishtar_common.wizards import SearchWizard
from wizards import *
from forms import *
import models

show_contextrecord = show_item(models.ContextRecord, 'contextrecord')
get_contextrecord = get_item(models.ContextRecord,
        'get_contextrecord', 'contextrecord',
      extra_request_keys={'parcel__town':'parcel__town__pk',
                  'operation__year':'operation__year__contains',
                  'datings__period':'datings__period__pk'},)
get_contextrecordsource = get_item(models.ContextRecordSource,
        'get_contextrecordsource', 'contextrecordsource',
      extra_request_keys={
    'context_record__parcel__town':'context_record__parcel__town__pk',
    'context_record__operation__year':'context_record__operation__year',
    'context_record__datings__period':'context_record__datings__period__pk',
    'context_record__unit':'context_record__unit__pk',
    })

record_search_wizard = SearchWizard.as_view([
                          ('general-record_search', RecordFormSelection)],
                          url_name='record_search',)

record_creation_wizard = RecordWizard.as_view([
    ('selec-record_creation', OperationRecordFormSelection),
    ('general-record_creation', RecordFormGeneral),
    ('datings-record_creation', DatingFormSet),
    ('interpretation-record_creation', RecordFormInterpretation),
    ('final-record_creation', FinalForm)],
     url_name='record_creation',)

record_modification_wizard = RecordModifWizard.as_view([
    ('selec-record_modification', RecordFormSelection),
    ('general-record_modification', RecordFormGeneral),
    ('datings-record_modification', DatingFormSet),
    ('interpretation-record_modification', RecordFormInterpretation),
    ('final-record_modification', FinalForm)],
     url_name='record_modification',)

record_deletion_wizard = RecordDeletionWizard.as_view([
                     ('selec-record_deletion', RecordFormSelection),
                     ('final-record_deletion', RecordDeletionForm)],
                      url_name='record_deletion',)

record_source_creation_wizard = RecordSourceWizard.as_view([
             ('selec-record_source_creation', SourceRecordFormSelection),
             ('source-record_source_creation', SourceForm),
             ('authors-record_source_creation', AuthorFormset),
             ('final-record_source_creation', FinalForm)],
                  url_name='record_source_creation',)

record_source_modification_wizard = RecordSourceWizard.as_view([
         ('selec-record_source_modification', RecordSourceFormSelection),
         ('source-record_source_modification', SourceForm),
         ('authors-record_source_modification', AuthorFormset),
         ('final-record_source_modification', FinalForm)],
          url_name='record_source_modification',)

record_source_deletion_wizard = RecordSourceDeletionWizard.as_view([
         ('selec-record_source_deletion', RecordSourceFormSelection),
         ('final-record_source_deletion', RecordDeletionForm)],
          url_name='record_source_deletion',)