def add_action(request): if request.method == 'POST': form = ActionForm(request.POST) if form.is_valid(): form.save() return redirect('index');
def _setup_forms(self): stack = QtGui.QStackedWidget() stack.addWidget(ActionForm()) stack.addWidget(ProjectForm()) stack.addWidget(ContextForm()) self._stack = stack return stack
def _setup_content(self): calendar = self._setup_calendar() detail = self._setup_detail() action_form = ActionForm(True) self.addWidget(calendar) self.addWidget(detail) self.addWidget(action_form) self._action_form = action_form
def _setup_content(self): context_list = self._setup_projects() self.addWidget(context_list) action_form = ActionForm(True) context_form = ContextForm(True) self.addWidget(action_form) self.addWidget(context_form) self._action_form = action_form self._context_form = context_form
def _setup_content(self): project_list = self._setup_projects() action_form = ActionForm(True) project_form = ProjectForm(True) self.addWidget(project_list) self.addWidget(action_form) self.addWidget(project_form) self._action_form = action_form self._project_form = project_form
def action(type, post_id): if 'like' == type: form = ActionForm() if form.validate_on_submit(): post = Bbs_post.query.get(post_id) r = post.liked_by(g.user) if 1 == r: # flash('Liked') Cost_log.post_like(g.user, post.author, post) # else: # flash('Unliked') db.session.commit() return redirect(url_for('bbs.detail', post_id=post_id)) elif 'mark' == type: form = ActionForm() if form.validate_on_submit(): post = Bbs_post.query.get(post_id) r = post.marked_by(g.user) # if 1 == r: # flash('Marked') # else: # flash('Unmarked') db.session.commit() return redirect(url_for('bbs.detail', post_id=post_id)) abort(404)
def detail(post_id): post = Bbs_post.query.get(post_id) if post is None: abort(404) X = {'post': post} act_form = ActionForm() X['act_form'] = act_form X['cmt'] = f_cmt(post) if type(X['cmt']) is int: return redirect(request.path + '#cmt_' + str(X['cmt'])) X['node'] = post.node post.inc_pv() return render_template('bbs/detail.html', X=X)
def _setup_content(self): inbox = self._setup_inbox() self.addWidget(inbox) action_form = ActionForm(True) self.addWidget(action_form) self._action_form = action_form