Esempio n. 1
0
def create_discussion(id):
	""" Create a new discussion within the proposal """
	p = Proposal.objects.get_or_404(id=id)
	form = AddDiscussionForm()
	if form.validate_on_submit():
		d = start_discussion(request.form.get("text"), schools=p.schools, form=form)
		p.add_discussion(d)
		return redirect(url_for('discussions.detail', id=d.id))
	return render_template('discussion/create.html',
		title=_('New discussion in @title', title=p.title),
		form=form)
def create_discussion(id):
	if current_user.is_anonymous():
		flash(Markup("<span class=\"glyphicon glyphicon-info-sign\"></span> You have to login before creating a discussion."), "info")
		return redirect('/login?next=' + str(request.path))

	""" Create a new discussion within the proposal """
	p = Proposal.objects.get_or_404(id=id)
	form = AddDiscussionForm()
	if form.validate_on_submit():
		d = start_discussion(request.form.get("text"), schools=p.schools, form=form)
		p.add_discussion(d)
		return redirect(url_for('discussions.detail', discussion_id=d.id, proposal_id=p.id))
	return render_template('discussion/create.html',
		title=_('New discussion in @title', title=p.title),
		form=form)
def create_discussion(id):
    if current_user.is_anonymous():
        flash(
            Markup(
                "<span class=\"glyphicon glyphicon-info-sign\"></span> You have to login before creating a discussion."
            ), "info")
        return redirect('/login?next=' + str(request.path))
    """ Create a new discussion within the proposal """
    p = Proposal.objects.get_or_404(id=id)
    form = AddDiscussionForm()
    if form.validate_on_submit():
        d = start_discussion(request.form.get("text"),
                             schools=p.schools,
                             form=form)
        p.add_discussion(d)
        return redirect(
            url_for('discussions.detail', discussion_id=d.id,
                    proposal_id=p.id))
    return render_template('discussion/create.html',
                           title=_('New discussion in @title', title=p.title),
                           form=form)