activate functions amd templates

This commit is contained in:
deflax 2017-07-14 16:04:27 +03:00
parent 41082f7808
commit a65bdd5f2e
6 changed files with 64 additions and 2 deletions

View file

@ -3,6 +3,7 @@ from flask_login import login_required, login_user, logout_user, current_user
from flask_sqlalchemy import get_debug_queries
from . import dmanager
from .forms import ActivateForm
from .. import db
from ..email import send_email
from ..models import User, Permission, Service

View file

@ -3,6 +3,7 @@ from flask_login import login_required, login_user, logout_user, current_user
from flask_sqlalchemy import get_debug_queries
from . import smanager
from .forms import ActivateForm
from .. import db
from ..email import send_email
from ..models import User, Permission, Service

View file

@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block title %}Activate{% endblock %}
{% block page_content %}
<div class="row">
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading">Activate</div>
<div class="panel-body">
<form method="POST" action"{{ url_for('dmanager.activate', itemid=itemid) }}">
<p>{{ form.period.label }}<br />{{ form.period }}<br />
{% for error in form.period.errors %}
{{ error }}<br />
{% endfor %}
</p>
<p>
{{ form.csrf_token() }}
{{ form.submit }}
</p>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block title %}Activate{% endblock %}
{% block page_content %}
<div class="row">
<div class="col-md-12">
<div class="panel panel-info">
<div class="panel-heading">Activate</div>
<div class="panel-body">
<form method="POST" action"{{ url_for('smanager.activate', itemid=itemid) }}">
<p>{{ form.period.label }}<br />{{ form.period }}<br />
{% for error in form.period.errors %}
{{ error }}<br />
{% endfor %}
</p>
<p>
{{ form.csrf_token() }}
{{ form.submit }}
</p>
</div>
</div>
</div>
{% endblock %}

View file

@ -11,7 +11,7 @@
<div class="panel-heading">Activate</div>
<div class="panel-body">
<form method="POST" action"{{ url_for('vmanager.activate', vmid=vmid) }}">
<form method="POST" action"{{ url_for('vmanager.activate', itemid=itemid) }}">
<p>{{ form.period.label }}<br />{{ form.period }}<br />
{% for error in form.period.errors %}
{{ error }}<br />

View file

@ -117,7 +117,7 @@ def deploy(product_id=None):
return render_template('vmanager/deploy.html', page=page, form=form, product_id=product_id, product_pic=product_pic, product_name=product_name, product_description=product_description, product_recipe=product_recipe)
@smanager.route('/activate/<int:itemid>', methods=['GET', 'POST'])
@vmanager.route('/activate/<int:itemid>', methods=['GET', 'POST'])
@login_required
def activate(itemid=0):
if current_user.wallet < 1: