Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/6.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
codiebeulaine committed Jul 12, 2018
2 parents b335115 + 9abfbab commit 2e3e011
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGE LOG
==========

6.9.0
-----
- Override choice field to textfield from charfied with 512 limit

6.8.2
-----
- Bug Fix: redirect to translated surveys when another language is selected
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.8.2
6.9.0
20 changes: 20 additions & 0 deletions molo/surveys/migrations/0027_override-512-char-limit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-07-12 10:37
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('surveys', '0026_remove_molosurveypageview_tag'),
]

operations = [
migrations.AlterField(
model_name='molosurveyformfield',
name='choices',
field=models.TextField(blank=True, help_text='Comma separated list of choices. Only applicable in checkboxes,radio and dropdown.', verbose_name='choices'),
),
]
7 changes: 7 additions & 0 deletions molo/surveys/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,13 @@ class MoloSurveyFormField(SkipLogicMixin, AdminLabelMixin,
QuestionPaginationMixin, AbstractFormField):
AbstractFormField.FORM_FIELD_CHOICES += (
('positive_number', _("Positive Number")),)
choices = models.TextField(
verbose_name=_('choices'),
blank=True,
help_text=_(
'Comma separated list of choices. Only applicable in checkboxes,'
'radio and dropdown.')
)
field_type = models.CharField(
verbose_name=_('field type'),
max_length=16, choices=AbstractFormField.FORM_FIELD_CHOICES)
Expand Down
25 changes: 25 additions & 0 deletions molo/surveys/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,31 @@ def setUp(self):
required=True
)

def test_survey_options_512_limit_overriden(self):
field_choices = [
'My favourite animal is a dog, because they bark',
'My favourite animal is a cat, because they meuow',
'My favourite animal is a bird, because they fly',
'My favourite animal is a lion, because that roar',
'My favourite animal is a hamster, because they have tiny legs',
'My favourite animal is a tiger, because they have stripes',
'My favourite animal is a frog, because they go crickit',
'My favourite animal is a fish, because they have nice eyes',
'My favourite animal is a chicken, because they cannot fly',
'My favourite animal is a duck, because they keep it down',
'My favourite animal is a wolf, because they howl',
'My favourite animal is a chamelion, because they fit in',
]
choice_field = MoloSurveyFormField.objects.create(
page=self.survey,
sort_order=1,
label='Your favourite animal',
field_type='dropdown',
skip_logic=skip_logic_data(field_choices),
required=True
)
self.assertTrue(len(choice_field.choices) > 512)

def test_choices_updated_from_streamfield_on_save(self):
self.assertEqual(
','.join(self.field_choices),
Expand Down

0 comments on commit 2e3e011

Please sign in to comment.