From: Nick Retallack Date: Sun, 6 Dec 2009 06:35:24 +0000 (-0800) Subject: posted by me checkbox X-Git-Url: http://git.veekun.com/zzz-floof.git/commitdiff_plain/c472ed30b5d4600a8ead8846ddbcbf3bb1b027d6?ds=sidebyside;hp=dcf6146e9914ff3c166f242b72f04a8934d65148 posted by me checkbox --- diff --git a/floof/controllers/art.py b/floof/controllers/art.py index 5b347b3..9a2f1ba 100644 --- a/floof/controllers/art.py +++ b/floof/controllers/art.py @@ -27,6 +27,7 @@ from wtforms import * class ArtUploadForm(Form): by = TextField('Artists') + by_me = BooleanField('me') file = FileField('Upload') url = TextField('Link') @@ -127,8 +128,11 @@ class ArtController(BaseController): ) c.art.discussion = Discussion(count=0) + if c.form.by_me and c.user not in c.form.by.data: + UserRelation(user=c.user, creator=c.user, kind="by", art=c.art) + for artist in c.form.by.data: - UserRelation(user=artist, kind="by", creator=c.user, art=c.art) + UserRelation(user=artist, creator=c.user, kind="by", art=c.art) try: diff --git a/floof/templates/art/new.mako b/floof/templates/art/new.mako index 4204700..684c004 100644 --- a/floof/templates/art/new.mako +++ b/floof/templates/art/new.mako @@ -7,8 +7,12 @@ ${h.form(h.url('create_art'), multipart=True)} -${normal_field(c.form.by)} -${normal_field(c.form.file)} +
+ ${normal_field(c.form.by)} + ${checkbox_field(c.form.by_me)} +
+ +
${normal_field(c.form.file)}
##Artist: ${h.text('artist')} @@ -17,17 +21,24 @@ ${h.submit(None, 'Upload!')} ${h.end_form()} +<%def name="field_errors(errors)"> + %if errors: + + %endif + + <%def name="normal_field(field)"> -
-${field.label()|n} -${field()|n} -%if field.errors: - -%endif -
+ ${field.label()|n} + ${field()|n} + ${field_errors(field.errors)} + +<%def name="checkbox_field(field)"> + ${field()|n} ${field.label()|n} + ${field_errors(field.errors)} + \ No newline at end of file