Exemple #1
1
def index(status = None):
	add = Watch(request.form)

	if request.method == 'GET' and status:
		return redirect('/')

	if request.method == 'POST' and add.validate():
		anime = Anime(add.name.data, add.subber.data, add.format.data, add.quality.data, add.email.data)
		anime.save()

		flash(
			'''
			You are now watching [{0}] {1}. To unwatch this click <a href="/unsubscribe/{2}">here</a>.
			'''.format(add.subber.data, add.name.data, anime.h)
		)

		return redirect('/success')

	return render_template('index.html', title = 'Watch My Anime', form = add, status = status)
Exemple #2
0
def add_anime():
    anime_data = request.get_json(force=True, silent=True)
    if anime_data == None:
        return "Bad request", 400
    anime = Anime(anime_data["title"], anime_data["image"], anime_data["studio"], anime_data["episodes"], anime_data["seasons"], None)
    anime.save()
    return json.dumps(anime.to_dict()), 201
Exemple #3
0
def index(status=None):
    add = Watch(request.form)

    if request.method == 'GET' and status:
        return redirect('/')

    if request.method == 'POST' and add.validate():
        anime = Anime(add.name.data, add.subber.data, add.format.data,
                      add.quality.data, add.email.data)
        anime.save()

        flash('''
			You are now watching [{0}] {1}. To unwatch this click <a href="/unsubscribe/{2}">here</a>.
			'''.format(add.subber.data, add.name.data, anime.h))

        return redirect('/success')

    return render_template('index.html',
                           title='Watch My Anime',
                           form=add,
                           status=status)