786
786
url = formencode.validators.URL(if_missing=None, not_empty=False)
787
787
synopsis = formencode.validators.UnicodeString(not_empty=True)
789
class ProjectEdit(BaseFormView):
790
"""A form to edit a project."""
791
template = 'templates/project-edit.html'
797
return ProjectSchema()
799
def populate(self, req, ctx):
800
super(ProjectEdit, self).populate(req, ctx)
801
ctx['projectset'] = self.context.project_set
803
def populate_state(self, state):
804
state.offering = self.context.project_set.offering
805
state.existing_project = self.context
807
def get_default_data(self, req):
809
'name': self.context.name,
810
'short_name': self.context.short_name,
811
'deadline': self.context.deadline,
812
'url': self.context.url,
813
'synopsis': self.context.synopsis,
816
def save_object(self, req, data):
817
self.context.name = data['name']
818
self.context.short_name = data['short_name']
819
self.context.deadline = data['deadline']
820
self.context.url = unicode(data['url']) if data['url'] else None
821
self.context.synopsis = data['synopsis']
789
824
class ProjectNew(BaseFormView):
790
825
"""A form to create a new project."""
791
826
template = 'templates/project-new.html'
896
931
(ProjectSet, '+edit', ProjectSetEdit),
897
932
(ProjectSet, '+new', ProjectNew),
898
933
(Project, '+index', ProjectView),
934
(Project, '+edit', ProjectEdit),
901
937
breadcrumbs = {Subject: SubjectBreadcrumb,