def post(self): form = TrackerForm(self.request.POST) if form.validate(): tracker = Tracker(type=form.type.data, name=form.name.data, url=form.url.data, mailer=form.mailer.data) self.session.add(tracker) self.flash(self._(u"New tracker added")) LOG(u"Tracker added") url = self.request.url_for('/tracker/list') return HTTPFound(location=url) return dict(form=form)
def post(self): tracker_id = self.request.GET.get('tracker_id') tracker = Tracker.query.get(tracker_id) form = TrackerForm(self.request.POST, obj=tracker) if form.validate(): tracker.type = form.type.data tracker.name = form.name.data tracker.url = form.url.data tracker.mailer = form.mailer.data self.flash(self._(u"Tracker saved")) LOG(u"Tracker saved") url = self.request.url_for('/tracker/list') return HTTPFound(location=url) return dict(tracker_id=tracker.id, form=form)
def post(self): form = TrackerForm(self.request.POST) if form.validate(): tracker = Tracker( type=form.type.data, name=form.name.data, url=form.url.data, mailer=form.mailer.data ) self.session.add(tracker) self.flash(self._(u"New tracker added")) LOG(u"Tracker added") url = self.request.url_for('/tracker/list') return HTTPFound(location=url) return dict(form=form)
def get(self): form = TrackerForm() return dict(form=form)
def get(self): tracker_id = self.request.GET.get('tracker_id') tracker = Tracker.query.get(tracker_id) form = TrackerForm(obj=tracker) return dict(tracker_id=tracker.id, form=form)