Skip to content

Commit

Permalink
fix 1259: la visualisation d'un extrait déclanche un conflit
Browse files Browse the repository at this point in the history
  • Loading branch information
artragis committed Jul 23, 2014
1 parent 98c0f07 commit 2f5534c
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions zds/tutorial/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1929,26 +1929,30 @@ def edit_extract(request):

if request.method == "POST":
data = request.POST
if content_has_changed([extract.get_path()], data["last_hash"]):
form = form = ExtractForm(initial={
"title": extract.title,
"text": extract.get_text()})
return render_template("tutorial/extract/edit.html",
{
"extract": extract,
"last_hash": compute_hash([extract.get_path()]),
"new_version":True,
"form": form
})
# Using the « preview button »

if "preview" in data:
form = ExtractForm(initial={"title": data["title"],
"text": data["text"]})
form = ExtractForm(initial={
"title": data["title"],
"text": data["text"]
})
return render_template("tutorial/extract/edit.html",
{"extract": extract, "form": form})
{
"extract": extract, "form": form,
"last_hash": compute_hash([extract.get_path()])
})
else:

if content_has_changed([extract.get_path()], data["last_hash"]):
form = ExtractForm(initial={
"title": extract.title,
"text": extract.get_text()})
return render_template("tutorial/extract/edit.html",
{
"extract": extract,
"last_hash": compute_hash([extract.get_path()]),
"new_version":True,
"form": form
})
# Edit extract.

form = ExtractForm(request.POST)
Expand Down

0 comments on commit 2f5534c

Please sign in to comment.