Merge pull request #316 from Gluejar/fix_new_edition

look before leaping
pull/1/head
Raymond Yee 2014-03-21 08:10:26 -07:00
commit 8a63609ed5
1 changed files with 1 additions and 1 deletions

View File

@ -551,7 +551,7 @@ def new_edition(request, work_id, edition_id, by=None):
form = EditionForm(instance=edition, data=request.POST, files=request.FILES) form = EditionForm(instance=edition, data=request.POST, files=request.FILES)
edition.ebook_form = EbookForm( instance= models.Ebook(user = request.user, edition = edition, provider = 'x' ), prefix = 'ebook_%d'%edition.id) edition.ebook_form = EbookForm( instance= models.Ebook(user = request.user, edition = edition, provider = 'x' ), prefix = 'ebook_%d'%edition.id)
elif request.POST.has_key('ebook_%d-edition' % edition.id): elif edition.id and request.POST.has_key('ebook_%d-edition' % edition.id):
edition.ebook_form= EbookForm( data = request.POST, prefix = 'ebook_%d'%edition.id) edition.ebook_form= EbookForm( data = request.POST, prefix = 'ebook_%d'%edition.id)
if edition.ebook_form.is_valid(): if edition.ebook_form.is_valid():
edition.ebook_form.save() edition.ebook_form.save()