Skip to content

Commit e0faadc

Browse files
committed
Merge branch 'master' into next
* master: Populate values for ApplicationContent admin_fields from parameters Conflicts: tests/testapp/tests/test_page.py
2 parents 68364b9 + 5291789 commit e0faadc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

feincms/content/application/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def __init__(self, *args, **kwargs):
213213
for k, v in self.custom_fields.items():
214214
v.initial = self.instance.parameters.get(k)
215215
self.fields[k] = v
216+
if k in self.instance.parameters:
217+
self.fields[k].initial = self.instance.parameters[k]
216218

217219
def save(self, commit=True, *args, **kwargs):
218220
# Django ModelForms return the model instance from save. We'll

tests/testapp/tests/test_page.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,8 +1427,8 @@ def test_25_applicationcontent(self):
14271427

14281428
# Check if admin_fields get populated correctly
14291429
app_ct = page.applicationcontent_set.all()[0]
1430-
app_ct.parameters = \
1431-
'{"custom_field":"val42", "exclusive_subpages": false}'
1430+
app_ct.parameters = (
1431+
'{"custom_field": "val42", "exclusive_subpages": false}')
14321432
app_ct.save()
14331433
r = self.client.get('/admin/page/page/%d/' % page.id)
14341434
self.assertContains(r, 'val42')

0 commit comments

Comments
 (0)