Skip to content

Instantly share code, notes, and snippets.

@lukexi
Created June 4, 2009 22:45
Show Gist options
  • Save lukexi/123910 to your computer and use it in GitHub Desktop.
Save lukexi/123910 to your computer and use it in GitHub Desktop.
class SiteForm(twf.TableForm):
action = 'save_site'
children = [
twf.HiddenField('id'),
twf.TextField('name', validator=twv.UnicodeString(not_empty=True)),
twf.TextField('url', validator=twv.URL(not_empty=True, add_http=True, check_exists=True),
label_text="Website URL")
]
class WebsiteMixin(object):
"""Additional methods for a Website object to contain"""
@property
def edit_form(self):
"""An edit form for a website"""
site_form = SiteForm('site_form_%d' % self.id)
return site_form(
self.__dict__
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment