diff options
| -rw-r--r-- | archaeological_operations/forms.py | 6 | ||||
| -rw-r--r-- | ishtar_common/models.py | 6 | ||||
| -rw-r--r-- | ishtar_common/views.py | 6 | 
3 files changed, 12 insertions, 6 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 3541020d8..4f5ac0435 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -740,9 +740,9 @@ class DashboardForm(IshtarForm):          if self.cleaned_data.get('preventive_research'):              preventive_research = self.cleaned_data['preventive_research']              if preventive_research == 'preventive': -                fltr['file_type__preventive'] = True -            elif preventive_research == 'preventive': -                fltr['file_type__preventive'] = False +                fltr['operation_type__preventive'] = True +            elif preventive_research == 'research': +                fltr['operation_type__preventive'] = False          if self.cleaned_data.get('operation_type'):              fltr['operation_type_id'] = self.cleaned_data['operation_type']          if self.cleaned_data.get('operator'): diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 3af92a39e..610d92551 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1800,7 +1800,7 @@ class DashboardFormItem(object):          return q.order_by('pk').distinct('pk')      @classmethod -    def get_total_number(cls, fltr={}): +    def get_total_number(cls, fltr=None):          q = cls.objects          if fltr:              q = q.filter(**fltr) @@ -1809,7 +1809,9 @@ class DashboardFormItem(object):  class Dashboard(object):      def __init__(self, model, slice='year', date_source=None, show_detail=None, -                 fltr={}): +                 fltr=None): +        if not fltr: +            fltr = {}          # don't provide date_source if it is not relevant          self.model = model          self.total_number = model.get_total_number(fltr) diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 301860ae3..e49918d78 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -204,7 +204,9 @@ account_deletion_wizard = wizards.IshtarUserDeletionWizard.as_view(      url_name='account_deletion',) -def get_autocomplete_generic(model, extra={'available': True}): +def get_autocomplete_generic(model, extra=None): +    if not extra: +        extra = {'available': True}      def func(request):          q = request.GET.get('term')          query = Q(**extra) @@ -339,6 +341,7 @@ def shortcut_menu(request):              current_selected_item[model_name] = new_selected_item      return render(request, 'ishtar/blocks/shortcut_menu.html', dct) +  CURRENT_ITEM_KEYS = (('file', File),                       ('operation', Operation),                       ('contextrecord', ContextRecord), @@ -585,6 +588,7 @@ def format_val(val):          val = val.decode('utf-8')      return unicode(val) +  HIERARCHIC_LEVELS = 5  HIERARCHIC_FIELDS = ['periods', 'period', 'unit', 'material_types',                       'material_type', 'conservatory_state', 'object_types']  | 
