forked from lepture/june
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lepture
committed
Sep 1, 2012
1 parent
e42a0d9
commit 90e1cf0
Showing
2 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from flask.ext.wtf import Form | ||
|
||
|
||
class TopicForm(Form): | ||
title = TextField( | ||
_('Title'), validators=[Required()] | ||
) | ||
slug = TextField( | ||
_('Slug'), | ||
validators=[Required(), Regexp(r'[a-z]+', message=messages[0])], | ||
description=messages[0] | ||
) | ||
fgcolor = TextField(_('Front Color')) | ||
bgcolor = TextField(_('Background Color')) | ||
description = TextAreaField( | ||
_('Description') | ||
) | ||
header = TextAreaField( | ||
_('Header') | ||
) | ||
sidebar = TextAreaField( | ||
_('Sidebar') | ||
) | ||
footer = TextAreaField( | ||
_('Footer') | ||
) | ||
limit_role = IntegerField(_('Role Limitation'), default=0) | ||
|
||
def save(self, obj=None): | ||
if not obj: | ||
obj = Node() | ||
|
||
for name, data in self.data.iteritems(): | ||
setattr(obj, name, data) | ||
|
||
db.session.add(obj) | ||
db.session.commit() | ||
return obj |
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