Created
June 4, 2009 23:04
-
-
Save lukexi/123918 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | |
] | |
site_form = SiteForm('original_id') | |
class WebsiteMixin(object): | |
"""Additional methods for a Website object to contain""" | |
@property | |
def edit_form(self): | |
"""An edit form for a website""" | |
return site_form( | |
self.__dict__, | |
id='site_form_%d' % self.id | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment