myspace: don't fail on formdefs without a category (#9214)

This commit is contained in:
Frédéric Péters 2015-12-05 17:21:50 +01:00
parent 72d2e60f7b
commit c77a2dc079
1 changed files with 6 additions and 2 deletions

View File

@ -91,12 +91,16 @@ class FormsRootDirectory(wcs.forms.root.RootDirectory):
r += htmltext('<h4 id="drafts">%s</h4>') % _('My Current Drafts')
r += htmltext('<ul>')
for f in draft:
if f.formdef.category:
category_url = '%s' % f.formdef.category.url_name
else:
category_url = '.'
r += htmltext('<li><a href="%s%s/%s/%s">%s</a>, %s') % (base_url,
f.formdef.category.url_name,
category_url,
f.formdef.url_name, f.id, f.formdef.name,
misc.localstrftime(f.receipt_time))
r += htmltext(' (<a href="%s%s/%s/%s?remove-draft">%s</a>)') % (base_url,
f.formdef.category.url_name,
category_url,
f.formdef.url_name, f.id, _('delete'))
r += htmltext('</li>')
r += htmltext('</ul>')