Repository: kartoza/prj.app

Issue:
Image attached to questions in lessons app are not displayed
I am creating a question on this sheet here:

http://changelog.qgis.org/en/qgis/section/composer-25/worksheet/using-expressions-map-composer-124/question/update/317/


![screen shot 2018-03-10 at 22 11 31](https://user-images.githubusercontent.com/178003/37246357-8c5df228-24b0-11e8-9d97-3b836438c9f4.png)



The image I have attached does not show under the question:

![screen shot 2018-03-10 at 22 11 12](https://user-images.githubusercontent.com/178003/37246336-366cb9f8-24b0-11e8-8403-7dfb0d32bb9d.png)

# Expected outcome:

IMage should be shown under questions
Lets remove the vertical constraint on lesson images
See e.g. http://changelog.qgis.org/en/inasafe/section/advanced-inasafe-customisation/detail/133/

<img width="1220" alt="screen shot 2018-03-12 at 13 56 54" src="https://user-images.githubusercontent.com/178003/37282509-55f3eac8-25fd-11e8-806d-14a61142d432.png">

Let's just maintain the original aspect ratio.


Discussion:

If you tweak the template, don't forget the PDF rendering too ;-)

Resolving patch:
diff --git a/django_project/lesson/forms/question.py b/django_project/lesson/forms/question.py
--- a/django_project/lesson/forms/question.py
+++ b/django_project/lesson/forms/question.py
@@ -9,6 +9,7 @@
     Fieldset,
     Field,
     Submit,
+    HTML,
 )
 
 from modeltranslation.forms import TranslationModelForm
@@ -32,7 +33,11 @@ def __init__(self, *args, **kwargs):
             Fieldset(
                 _('Worksheet {}: question details').format(self.worksheet),
                 Field('question', css_class='form_control'),
-                Field('question_image', css_class='form_control'),
+                HTML(
+                    '{% if form.question_image.value %}'
+                    '<img class="img-responsive" '
+                    'src="{{ MEDIA_URL }}{{ form.question_image.value }}">'
+                    '{% endif %}', ),
                 css_id='project-form'
             )
         )
diff --git a/django_project/lesson/migrations/0024_auto_20180312_1726.py b/django_project/lesson/migrations/0024_auto_20180312_1726.py
new file mode 100644
--- /dev/null
+++ b/django_project/lesson/migrations/0024_auto_20180312_1726.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('lesson', '0023_auto_20180308_0200'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='worksheet',
+            name='more_about_title_en',
+            field=models.CharField(default='More about', max_length=200, null=True, help_text='More about title.'),
+        ),
+        migrations.AddField(
+            model_name='worksheet',
+            name='more_about_title_ind',
+            field=models.CharField(default='More about', max_length=200, null=True, help_text='More about title.'),
+        ),
+    ]
diff --git a/django_project/lesson/translation.py b/django_project/lesson/translation.py
--- a/django_project/lesson/translation.py
+++ b/django_project/lesson/translation.py
@@ -47,6 +47,7 @@ class WorksheetTranslation(TranslationMixinTranslation):
         'summary_text',
         'exercise_goal',
         'exercise_task',
+        'more_about_title',
         'more_about_text',
     )
 


Test patch: