Пример #1
0
def evidence(id):
    objective = get_objective_or_404(id=id)

    if request.method == 'POST':
        create_log_entry('evidence', **request.get_json())
        objective.link(evidence)
        objective.reload()

    return jsonify({'evidence': [e.to_json() for e in objective.evidence]})
def get_feedback():

    if request.method == 'POST':
        recipients = User.objects.filter(
            email__in=request.form.getlist('q'))
        share = bool(request.form.get('share-objectives'))
        user = current_user._get_current_object()

        if recipients:
            for recipient in recipients:

                feedback = create_log_entry(
                    'feedback',
                    requested_by=user.email,
                    requested_from=recipient.email,
                    requested_by_name=user.full_name,
                    requested_from_name=recipient.full_name,
                    template=request.form.get('feedback-template'),
                    share_objectives=share)

                if share:
                    for objective in user.objectives:
                        feedback.link(objective)

                feedback.add_tag('Feedback')

                _send_feedback_email(feedback, user, recipient)

            flash('Submitted request')

            return redirect(url_for('.requested_feedback'))

        flash('Failed submitting request(s)', 'error')

    return render_template('feedback/get-feedback.html')
Пример #3
0
def get_feedback():

    if request.method == 'POST':
        recipients = User.objects.filter(email__in=request.form.getlist('q'))
        share = bool(request.form.get('share-objectives'))
        user = current_user._get_current_object()

        if recipients:
            for recipient in recipients:

                feedback = create_log_entry(
                    'feedback',
                    requested_by=user.email,
                    requested_from=recipient.email,
                    requested_by_name=user.full_name,
                    requested_from_name=recipient.full_name,
                    template=request.form.get('feedback-template'),
                    share_objectives=share)

                if share:
                    for objective in user.objectives:
                        feedback.link(objective)

                feedback.add_tag('Feedback')

                _send_feedback_email(feedback, user, recipient)

            flash('Submitted request')

            return redirect(url_for('.requested_feedback'))

        flash('Failed submitting request(s)', 'error')

    return render_template('feedback/get-feedback.html')
Пример #4
0
    def create(self):
        note = create_log_entry('log',
                                title=self.title.data,
                                content=self.content.data)

        self.add_tags(note, self.tags.data)

        return note
    def create(self):
        note = create_log_entry(
            'log',
            title=self.title.data,
            content=self.content.data)

        self.add_tags(note, self.tags.data)

        return note
Пример #6
0
    def create(self):
        objective = create_log_entry(
            'objective',
            title=self.title.data,
            what=self.what.data,
            how=self.how.data,
            progress=self.progress.data,
            started_on=datetime.datetime.utcnow(),
            due_by=a_year_from_now())

        objective.add_tag('Objective')

        return objective
Пример #7
0
def promote_note(id, note_id):
    note = get_or_404(LogEntry, entry_type='log', id=note_id)

    evidence = create_log_entry(
        'evidence',
        title=note.entry.title,
        content=note.entry.content)

    objective = get_objective_or_404(id=id)
    objective.link(evidence)

    flash('Evidence created from note')

    return redirect(url_for('.view', id=id))
Пример #8
0
def promote_note(id, note_id):
    note = get_or_404(LogEntry, entry_type='log', id=note_id)

    evidence = create_log_entry(
        'evidence',
        title=note.entry.title,
        content=note.entry.content)

    objective = get_objective_or_404(id=id)
    objective.link(evidence)

    flash('Evidence created from note')

    return redirect(url_for('.view', id=id))
Пример #9
0
def add_evidence(id):
    objective = get_objective_or_404(id=id)
    form = EvidenceForm()

    if form.validate_on_submit():
        evidence = create_log_entry('evidence', **request.form.to_dict())
        objective.link(evidence)

        flash('Evidence added')

        return redirect(url_for('.view', id=id))

    return render_template(
        'objectives/add_evidence.html',
        form=form,
        objective=objective)