mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
Refactor users page
This commit is contained in:
parent
d9303ff940
commit
02ae7336ea
20 changed files with 55 additions and 25 deletions
|
@ -7,7 +7,7 @@ from django.db import models, migrations
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0001_initial'),
|
||||
('accounts', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
|
@ -7,7 +7,7 @@ from django.db import models, migrations
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0002_userinstance_is_block'),
|
||||
('accounts', '0002_userinstance_is_block'),
|
||||
]
|
||||
|
||||
operations = [
|
|
@ -3,12 +3,23 @@ from django.http import HttpResponseRedirect
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.auth.models import User
|
||||
from users.models import UserInstance
|
||||
from accounts.models import UserInstance
|
||||
from instances.models import Instance
|
||||
from users.forms import UserAddForm
|
||||
from accounts.forms import UserAddForm
|
||||
|
||||
|
||||
def users(request):
|
||||
def profile(request):
|
||||
"""
|
||||
:param request:
|
||||
:return:
|
||||
"""
|
||||
if not request.user.is_authenticated():
|
||||
return HttpResponseRedirect(reverse('index'))
|
||||
|
||||
return render(request, 'profile.html', locals())
|
||||
|
||||
|
||||
def accounts(request):
|
||||
"""
|
||||
:param request:
|
||||
:return:
|
||||
|
@ -64,10 +75,10 @@ def users(request):
|
|||
user_delete.delete()
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
|
||||
return render(request, 'users.html', locals())
|
||||
return render(request, 'accounts.html', locals())
|
||||
|
||||
|
||||
def user(request, user_id):
|
||||
def account(request, user_id):
|
||||
"""
|
||||
:param request:
|
||||
:return:
|
||||
|
@ -110,4 +121,4 @@ def user(request, user_id):
|
|||
add_user_inst.save()
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
|
||||
return render(request, 'user.html', locals())
|
||||
return render(request, 'account.html', locals())
|
|
@ -3,7 +3,7 @@ from django.core.urlresolvers import reverse
|
|||
from django.shortcuts import render
|
||||
from computes.models import Compute
|
||||
from instances.models import Instance
|
||||
from users.models import UserInstance
|
||||
from accounts.models import UserInstance
|
||||
from computes.forms import ComputeAddTcpForm, ComputeAddSshForm, ComputeEditHostForm, ComputeAddTlsForm, ComputeAddSocketForm
|
||||
from vrtManager.hostdetails import wvmHostDetails
|
||||
from vrtManager.connection import CONN_SSH, CONN_TCP, CONN_TLS, CONN_SOCKET, connection_manager
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.shortcuts import render
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
from computes.models import Compute
|
||||
from instances.models import Instance
|
||||
from users.models import UserInstance
|
||||
from accounts.models import UserInstance
|
||||
from vrtManager.hostdetails import wvmHostDetails
|
||||
from vrtManager.instance import wvmInstance, wvmInstances
|
||||
from vrtManager.connection import connection_manager
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="panel {% if user.is_active %}panel-success{% else %}panel-danger{% endif %} panel-data">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<a href="{% url 'user' user.id %}"><strong>{{ user.username }}</strong></a>
|
||||
<a href="{% url 'account' user.id %}"><strong>{{ user.username }}</strong></a>
|
||||
<a data-toggle="modal" href="#editUser{{ user.id }}" class="pull-right" title="{% trans "Edit" %}">
|
||||
<span class="glyphicon glyphicon-cog"></span>
|
||||
</a>
|
|
@ -16,11 +16,11 @@
|
|||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> {{ request.user.username }} <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a href="#"><i class="fa fa-fw fa-user"></i> Profile</a>
|
||||
<a href="{% url 'profile' %}"><i class="fa fa-fw fa-user"></i> Profile</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<a href="#"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
|
||||
<a href="{% url 'logout' %}"><i class="fa fa-fw fa-power-off"></i> Log Out</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
20
templates/profile.html
Normal file
20
templates/profile.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Logs" %}{% endblock %}
|
||||
{% block content %}
|
||||
<!-- Page Heading -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="page-header">{% trans "Profile" %}</h1>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
{% include 'errors_block.html' %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -37,8 +37,8 @@
|
|||
{% for log in logs %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td><a href="{% url 'user' log.user.id %}">{{ log.user }}</a></td>
|
||||
<td><a href="{% url 'instance' log.instance.compute.id log.instanceg %}">{{ log.instance }}</a></td>
|
||||
<td><a href="{% url 'account' log.user.id %}">{{ log.user }}</a></td>
|
||||
<td><a href="{% url 'instance' log.instance.compute.id log.instance %}">{{ log.instance }}</a></td>
|
||||
<td>{{ log.message }}</td>
|
||||
<td style="width:120px;">{{ log.date|date:"M d H:i:s" }}</td>
|
||||
</tr>
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<li {% class_active request "^/compute" %}{% class_active request "^/create" %}>
|
||||
<a href="{% url 'computes' %}"><i class="fa fa-fw fa-tasks"></i> {% trans "Computes" %}</a>
|
||||
</li>
|
||||
<li {% class_active request "^/user" %}>
|
||||
<a href="{% url 'users' %}"><i class="fa fa-fw fa-users"></i> {% trans "Users" %}</a>
|
||||
<li {% class_active request "^/account" %}>
|
||||
<a href="{% url 'accounts' %}"><i class="fa fa-fw fa-users"></i> {% trans "Users" %}</a>
|
||||
</li>
|
||||
<li {% class_active request "^/log" %}>
|
||||
<a href="{% url 'showlogs' %}"><i class="fa fa-fw fa-list-alt"></i> {% trans "Logs" %}</a>
|
||||
|
|
|
@ -23,7 +23,7 @@ INSTALLED_APPS = (
|
|||
'django.contrib.staticfiles',
|
||||
'computes',
|
||||
'instances',
|
||||
'users',
|
||||
'accounts',
|
||||
'create',
|
||||
'logs',
|
||||
)
|
||||
|
|
|
@ -2,11 +2,11 @@ from django.conf.urls import patterns, include, url
|
|||
from django.contrib import admin
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'),
|
||||
url(r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'}, name='logout'),
|
||||
|
||||
url(r'^login/$', 'django.contrib.auth.views.login'),
|
||||
url(r'^logout/$', 'django.contrib.auth.views.logout'),
|
||||
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'),
|
||||
url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'}, name='logout'),
|
||||
url(r'^accounts/profile/$', 'accounts.views.profile', name='profile'),
|
||||
url(r'^accounts/$', 'accounts.views.accounts', name='accounts'),
|
||||
url(r'^accounts/profile/(\d+)/$', 'accounts.views.account', name='account'),
|
||||
|
||||
url(r'^$', 'instances.views.index', name='index'),
|
||||
url(r'^instances$', 'instances.views.instances', name='instances'),
|
||||
|
@ -26,8 +26,7 @@ urlpatterns = patterns('',
|
|||
|
||||
url(r'^compute/secret/(\d+)/$', 'secrets.views.secrets', name='secrets'),
|
||||
|
||||
url(r'^users/$', 'users.views.users', name='users'),
|
||||
url(r'^user/(\d+)/$', 'users.views.user', name='user'),
|
||||
|
||||
|
||||
url(r'^console/$', 'console.views.console', name='console'),
|
||||
url(r'^create/(\d+)/$', 'create.views.create_instance', name='create_instance'),
|
||||
|
|
Loading…
Reference in a new issue