Skip to content

Commit

Permalink
comment on why i'm not using deform's builtin readonly=True capability
Browse files Browse the repository at this point in the history
  • Loading branch information
ejucovy committed Aug 25, 2011
1 parent b30807b commit 60b9232
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main/views.py
Expand Up @@ -37,6 +37,13 @@ def view_state(request, state_id):
if state.game:
readonly = True

# Deform's form.render API allows you to pass a readonly=True flag
# to have deform render a readonly representation of the data;
# but, the default readonly templates aren't form-like, they're just
# unstyled lists which look really ugly in our layout.
# So, instead, the mvsim django template receives the readonly flag,
# and, if it's set, removes Deform's javascript and injects some JS
# to disable all the form fields on page load. The result is prettier.
if request.method == "GET":
return {'form': form.render(state.loads()),
'readonly': readonly,
Expand Down

0 comments on commit 60b9232

Please sign in to comment.