diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-07-12 00:05:13 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-07-12 00:05:13 +0200 |
commit | 07182d8f114eb87e9e1ae958df6c46d7dbac3b56 (patch) | |
tree | 90fdc3f3ffc46dc609eff3928873d323e940c0e2 | |
parent | 97c568b85ae2969cf30665e6ebcc1620721e1195 (diff) | |
parent | f2e2d4f7c7172cc84c14613ea4049ae54e75d818 (diff) | |
download | Ishtar-07182d8f114eb87e9e1ae958df6c46d7dbac3b56.tar.bz2 Ishtar-07182d8f114eb87e9e1ae958df6c46d7dbac3b56.zip |
Merge branch 'master' into develop
-rw-r--r-- | CHANGES.md | 11 | ||||
-rw-r--r-- | archaeological_finds/tests.py | 34 | ||||
-rw-r--r-- | archaeological_finds/views.py | 7 | ||||
-rw-r--r-- | archaeological_finds/wizards.py | 1 | ||||
-rw-r--r-- | ishtar_common/wizards.py | 9 | ||||
-rw-r--r-- | version.py | 4 |
6 files changed, 56 insertions, 10 deletions
diff --git a/CHANGES.md b/CHANGES.md index 20a3113db..d936b7cb2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,17 @@ Ishtar changelog ================ +v0.99.23 (2017-07-11) +--------------------- +### Features ### +- Tests: add show-* tests +- Tests: improve wizard test management + +### Bug fixes ### +- Fix find deletion when warehouse module is activated +- Archaeologivcal files: safely manage is_preventive test if preventive type is not created - show-file test +- Account : fix form initialization when raw name is empty + v0.99.22 (2017-06-30) --------------------- ### Features ### diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 3aa0f6ea0..75f580633 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -26,7 +26,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.core.urlresolvers import reverse from django.test.client import Client from ishtar_common.models import ImporterType, IshtarUser, ImporterColumn,\ - FormaterType, ImportTarget + FormaterType, ImportTarget, IshtarSiteProfile from ishtar_common.models import Person, get_current_profile from archaeological_context_records.models import Period, Dating @@ -95,7 +95,6 @@ class FindInit(ContextRecordInit): class FindWizardCreationTest(WizardTest, FindInit, TestCase): - # TODO: first to be run because of strange init things... fixtures = [settings.ROOT_PATH + '../fixtures/initial_data.json', settings.ROOT_PATH + @@ -154,6 +153,37 @@ class FindWizardCreationTest(WizardTest, FindInit, TestCase): self.assertEqual(find.datings.count(), 1) +class FindWizardDeletionWithWarehouseModTest(WizardTest, FindInit, TestCase): + fixtures = FindWizardCreationTest.fixtures + url_name = 'find_deletion' + wizard_name = 'find_deletion_wizard' + steps = views.find_deletion_steps + form_datas = [ + FormData( + 'Find deletion', + form_datas={ + 'selecw': {}, + }, + ignored=['selec-find_deletion'] + ) + ] + + def pre_wizard(self): + profile, created = IshtarSiteProfile.objects.get_or_create( + slug='default', active=True) + profile.warehouse = True + profile.save() + + find, bf = self.get_default_find(force=True) + self.form_datas[0].set('selecw', 'pk', find.pk) + self.find_number = models.Find.objects.count() + super(FindWizardDeletionWithWarehouseModTest, self).pre_wizard() + + def post_wizard(self): + self.assertEqual(models.Find.objects.count(), + self.find_number - 1) + + class TreatmentWizardCreationTest(WizardTest, FindInit, TestCase): fixtures = [settings.ROOT_PATH + '../fixtures/initial_data.json', diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index 681296b3c..4874abefb 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -181,10 +181,13 @@ find_deletion_condition_dict = { 'selecw-find_deletion': check_warehouse_module, } -find_deletion_wizard = FindDeletionWizard.as_view([ +find_deletion_steps = [ ('selec-find_deletion', FindFormSelection), ('selecw-find_deletion', FindFormSelectionWarehouseModule), - ('final-find_deletion', FindDeletionForm)], + ('final-find_deletion', FindDeletionForm)] + +find_deletion_wizard = FindDeletionWizard.as_view( + find_deletion_steps, condition_dict=find_deletion_condition_dict, label=_(u"Find deletion"), url_name='find_deletion',) diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py index 43fe6262f..b4471a80b 100644 --- a/archaeological_finds/wizards.py +++ b/archaeological_finds/wizards.py @@ -83,6 +83,7 @@ class FindModificationWizard(FindWizard): class FindDeletionWizard(DeletionWizard): model = models.Find + main_item_select_keys = ('selec-', 'selecw-') fields = ['label', 'material_types', 'datings', 'find_number', 'object_types', 'description', 'conservatory_state', 'mark', 'preservation_to_considers', 'integrities', 'remarkabilities', diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index e8b079bf6..128833ad4 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -1242,10 +1242,11 @@ class DeletionWizard(Wizard): def done(self, form_list, **kwargs): obj = self.get_current_object() - try: - obj.delete() - except ObjectDoesNotExist: - pass + if obj: + try: + obj.delete() + except ObjectDoesNotExist: + pass return render_to_response( 'ishtar/wizard/wizard_delete_done.html', {}, context_instance=RequestContext(self.request)) diff --git a/version.py b/version.py index 9218f4cb4..061d7afda 100644 --- a/version.py +++ b/version.py @@ -1,5 +1,5 @@ -# 1.99.2 -VERSION = (1, 99, 2) +# 1.99.3 +VERSION = (1, 99, 3) def get_version(): |