diff --git a/src/forest/admin/routes.py b/src/forest/admin/routes.py index 35cfaed..68e866c 100644 --- a/src/forest/admin/routes.py +++ b/src/forest/admin/routes.py @@ -31,7 +31,7 @@ def index(): @fresh_login_required @admin_required def list_users(page): - sqlquery = User.query.filter_by(active=True).order_by(User.last_seen.desc()).paginate(page=page, per_page=current_app.config['ITEMS_PER_PAGE'], error_out=False) + sqlquery = User.query.filter_by(active=True).order_by(User.last_seen.desc()).paginate(page=page, per_page=int(current_app.config['ITEMS_PER_PAGE']), error_out=False) return render_template('admin/list_users.html', users=sqlquery.items, page=page) @admin.route("/listitems", methods=['GET']) diff --git a/src/forest/auth/routes.py b/src/forest/auth/routes.py index 02df267..e5264eb 100644 --- a/src/forest/auth/routes.py +++ b/src/forest/auth/routes.py @@ -30,7 +30,7 @@ def before_request(): #print('session: %s' % str(session)) if current_user.is_authenticated: current_user.ping() - #print('request for {} from {}#{}'.format(request.endpoint, current_user.email, current_user.pid)) + #print('request for {} from {}#{}'.format(request.endpoint, current_user.email, current_user.id)) if not current_user.confirmed and request.endpoint[:5] != 'auth.' and request.endpoint != 'static': print(request.endpoint) return redirect(url_for('auth.unconfirmed')) diff --git a/src/forest/panel/routes.py b/src/forest/panel/routes.py index 33eebbc..842a187 100644 --- a/src/forest/panel/routes.py +++ b/src/forest/panel/routes.py @@ -25,9 +25,9 @@ from datetime import date, time, datetime # # form = OrderForm() # if form.validate_on_submit(): -# region = Region.query.filter_by(pid=int(form.region.data)).first() -# recipe = Recipe.query.filter_by(pid=int(form.recipe.data)).first() -# new_order = Order(user_id=int(current_user.pid), region_id=int(region.pid), recipe_id=int(recipe.pid), parameter1=str(form.alias.data), parameter2=str(form.cpu.data), parameter3=str(form.memory.data), parameter4=str(form.storage.data), status='new') +# region = Region.query.filter_by(id=int(form.region.data)).first() +# recipe = Recipe.query.filter_by(id=int(form.recipe.data)).first() +# new_order = Order(user_id=int(current_user.id), region_id=int(region.id), recipe_id=int(recipe.id), parameter1=str(form.alias.data), parameter2=str(form.cpu.data), parameter3=str(form.memory.data), parameter4=str(form.storage.data), status='new') # db.session.add(new_order) # db.session.commit() # send_email(current_app.config['MAIL_USERNAME'], 'New order from {}'.format(current_user.email), @@ -37,14 +37,14 @@ from datetime import date, time, datetime # return render_template('panel/deploy.html', form=form) #DASHBOARD -@panel.route("/dashboard", defaults={'user_pid': 0}, methods=['GET']) -@panel.route("/dashboard/", methods=['GET']) +@panel.route("/dashboard", defaults={'user_id': 0}, methods=['GET']) +@panel.route("/dashboard/", methods=['GET']) @login_required -def dashboard(user_pid): - if user_pid == 0: +def dashboard(user_id): + if user_id == 0: cuser = current_user else: - cuser = User.query.filter_by(id=user_pid).first() + cuser = User.query.filter_by(id=user_id).first() if cuser == None: abort(404) if not current_user.is_administrator(): diff --git a/src/forest/settings/forms.py b/src/forest/settings/forms.py index 15cb5b5..585f9cb 100644 --- a/src/forest/settings/forms.py +++ b/src/forest/settings/forms.py @@ -46,7 +46,7 @@ class EditProfileAdminForm(FlaskForm): def __init__(self, user, *args, **kwargs): super(EditProfileAdminForm, self).__init__(*args, **kwargs) - self.role.choices = [(role.pid, role.name) + self.role.choices = [(role.id, role.name) for role in Role.query.order_by(Role.name).all()] self.user = user diff --git a/src/forest/templates/admin/charge.html b/src/forest/templates/admin/charge.html index 1e11328..2f79fe1 100644 --- a/src/forest/templates/admin/charge.html +++ b/src/forest/templates/admin/charge.html @@ -11,7 +11,7 @@
Зареждане на сметка
-
+

Current Value: {{ usr.wallet }}
{{ form.amount.label }} {{ form.amount }}
diff --git a/src/forest/templates/admin/list_addresses.html b/src/forest/templates/admin/list_addresses.html index 7772351..1d10490 100644 --- a/src/forest/templates/admin/list_addresses.html +++ b/src/forest/templates/admin/list_addresses.html @@ -35,7 +35,7 @@ {{ address.ip }} {% if address.user_id != None %} - {{ address.owner.email }} + {{ address.owner.email }} {% else %} {% endif %} diff --git a/src/forest/templates/admin/list_archive.html b/src/forest/templates/admin/list_archive.html index 9faae42..6668946 100644 --- a/src/forest/templates/admin/list_archive.html +++ b/src/forest/templates/admin/list_archive.html @@ -88,7 +88,7 @@ addEventListener("DOMContentLoaded", function() { {% endif %} {% endif %} {% endif %} - {{ deploy.owner.email }} + {{ deploy.owner.email }} {{ deploy.machine_alias }} {{ deploy.machine_cpu }} {{ deploy.machine_mem }} MB diff --git a/src/forest/templates/admin/list_deployments.html b/src/forest/templates/admin/list_deployments.html index 6940181..fda744a 100644 --- a/src/forest/templates/admin/list_deployments.html +++ b/src/forest/templates/admin/list_deployments.html @@ -54,7 +54,7 @@ {{ moment(deploy.date_last_charge).format('lll') }} ({{ moment(deploy.date_last_charge).fromNow() }}) {% endif %} {{ deploy.daysleft }} - {{ deploy.owner.email }} + {{ deploy.owner.email }} {% endfor %} diff --git a/src/forest/templates/admin/list_domains.html b/src/forest/templates/admin/list_domains.html index f39dbf9..fbe45cf 100644 --- a/src/forest/templates/admin/list_domains.html +++ b/src/forest/templates/admin/list_domains.html @@ -33,7 +33,7 @@ {% endif %} {% endif %} - {{ domain.owner.email }} + {{ domain.owner.email }} {{ domain.fqdn }} {{ domain.date_expire }} {{ domain.daysleft }} diff --git a/src/forest/templates/admin/list_orders.html b/src/forest/templates/admin/list_orders.html index 460ff91..3815bf3 100644 --- a/src/forest/templates/admin/list_orders.html +++ b/src/forest/templates/admin/list_orders.html @@ -30,7 +30,7 @@ {% for order in neworders %} - {{ order.owner.email }} + {{ order.owner.email }} {{ order.region.description }} {{ order.recipe.templatefile }} {{ order.parameter1 }} @@ -38,12 +38,12 @@ {{ order.parameter3 }} {{ order.parameter4 }} {{ order.status }} - + {% endfor %} {% for order in oldorders %} - {{ order.owner.email }} + {{ order.owner.email }} {{ order.region.description }} {{ order.recipe.templatefile }} {{ order.parameter1 }} diff --git a/src/forest/templates/admin/list_servers.html b/src/forest/templates/admin/list_servers.html index abc442b..4c3b35c 100644 --- a/src/forest/templates/admin/list_servers.html +++ b/src/forest/templates/admin/list_servers.html @@ -33,7 +33,7 @@ {{ server.hdd }} {{ server.address }} {{ server.region.name }} - {{ server.owner.email }} + {{ server.owner.email }} {% endfor %} diff --git a/src/forest/templates/admin/list_services.html b/src/forest/templates/admin/list_services.html index f0557c3..ad92aa8 100644 --- a/src/forest/templates/admin/list_services.html +++ b/src/forest/templates/admin/list_services.html @@ -36,7 +36,7 @@ {% endif %} {% endif %} - {{ service.owner.email }} + {{ service.owner.email }} {{ service.category }} {{ service.description }} {{ service.price }} diff --git a/src/forest/templates/admin/list_transactions.html b/src/forest/templates/admin/list_transactions.html index 933a3ad..d1be510 100644 --- a/src/forest/templates/admin/list_transactions.html +++ b/src/forest/templates/admin/list_transactions.html @@ -25,18 +25,18 @@ {% for transaction in transactions %} {% if transaction.value > 0 %} - {{ transaction.pid }} + {{ transaction.id }} {{ transaction.description }} {{ transaction.value }} {{ transaction.currency }} {{ moment(transaction.date_created).format('lll') }} - {{ transaction.owner.email }} + {{ transaction.owner.email }} {% else %} - {{ transaction.pid }} + {{ transaction.id }} {{ transaction.description }} {{ transaction.value }} {{ transaction.currency }} {{ moment(transaction.date_created).format('lll') }} - {{ transaction.owner.email }} + {{ transaction.owner.email }} {% endif %} diff --git a/src/forest/templates/admin/list_users.html b/src/forest/templates/admin/list_users.html index 72989c8..30fb121 100644 --- a/src/forest/templates/admin/list_users.html +++ b/src/forest/templates/admin/list_users.html @@ -28,9 +28,9 @@ {{ usr.last_ip }} {{ usr.wallet }} {{ usr.currency }} - - - + + + {% endfor %} diff --git a/src/forest/templates/admin/menu_cloud.html b/src/forest/templates/admin/menu_cloud.html index 2f4422e..a972979 100644 --- a/src/forest/templates/admin/menu_cloud.html +++ b/src/forest/templates/admin/menu_cloud.html @@ -1,6 +1,2 @@ - - - -