diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-09 12:53:24 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-02-09 12:55:47 +0100 | 
| commit | f6bc90850085b46401e0596d22ddd9f017f893e7 (patch) | |
| tree | b905dd188ae1fd981b72eb874dda27f116beb597 | |
| parent | 7ff5dd8f5d8cab189aa7cc009874ae384ff07240 (diff) | |
| download | Ishtar-f6bc90850085b46401e0596d22ddd9f017f893e7.tar.bz2 Ishtar-f6bc90850085b46401e0596d22ddd9f017f893e7.zip | |
Shortcut menu: fix when current selected find is an integer (refs #3455)
| -rw-r--r-- | archaeological_finds/models_treatments.py | 2 | ||||
| -rw-r--r-- | ishtar_common/tests.py | 11 | 
2 files changed, 10 insertions, 3 deletions
| diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 57ab530bf..3e9077a48 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -177,7 +177,7 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):          if menu_filtr:              if 'treatmentfile' in menu_filtr:                  replace_query = Q(file=menu_filtr['treatmentfile']) -            if 'find' in menu_filtr and 'basket' not in menu_filtr['find']: +            if 'find' in menu_filtr and 'basket' not in str(menu_filtr['find']):                  q = Q(upstream=menu_filtr['find']) | Q(                      downstream=menu_filtr['find'])                  if replace_query: diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index a3fa62ce7..82acb1904 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -650,7 +650,7 @@ class ShortMenuTest(TestCase):          self.assertEqual(response.status_code, 200)          self.assertTrue(str(basket.label) in response.content) -    def testTreatmentFile(self): +    def test_treatment_file(self):          c = Client()          c.login(username=self.username, password=self.password)          from archaeological_finds.models import TreatmentFile, TreatmentFileType @@ -693,7 +693,7 @@ class ShortMenuTest(TestCase):              year=2052          ) -    def testTreatment(self): +    def test_treatment(self):          c = Client()          c.login(username=self.username, password=self.password)          treat = self._create_treatment() @@ -747,6 +747,13 @@ class ShortMenuTest(TestCase):          self.assertFalse(c.session['find'])          self.assertFalse(c.session['contextrecord']) +        # current find is set as an integer +        session = c.session +        session['find'] = find.id +        session.save() +        response = c.get(reverse('shortcut-menu')) +        self.assertEqual(response.status_code, 200) +          self._create_treatment()      def test_basket_is_current_item(self): | 
