Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
Allow to set values of a form in form_values in the session.
Browse files Browse the repository at this point in the history
The query values cannot be used, if the value is a name.
  • Loading branch information
reiterl authored and toirl committed Jul 20, 2016
1 parent 67d6d5e commit 483d498
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ringo/views/base/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def create(request, callback=None, renderers=None, validators=None):
rvalues = get_return_value(request)
values = {'_roles': [str(r.name) for r in request.user.roles]}
values.update(params.get('values', {}))
form_values = request.session.get("form_values") or {}
values.update(form_values)
request.session["form_values"] = None
request.session.save()
rvalues['form'] = render_item_form(request, form, values, False)
return rvalues

Expand Down

2 comments on commit 483d498

@toirl
Copy link
Member

@toirl toirl commented on 483d498 Oct 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the query values can not be used? What was the actual problem when using the "values" Attribute?
Meanwhile the create view also takes a "values" attribute which might be used.
I think there is a better solution than adding a new session variable which is only used and filled in a specific ringo based application.

@g-tom
Copy link

@g-tom g-tom commented on 483d498 Aug 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backref #31

Please sign in to comment.