mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
Think about new macbook
This commit is contained in:
parent
5ba82e29aa
commit
90d8dd5729
4 changed files with 69 additions and 3 deletions
30
logs/migrations/0002_auto_20150316_1420.py
Normal file
30
logs/migrations/0002_auto_20150316_1420.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
import datetime
|
||||||
|
from django.conf import settings
|
||||||
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('logs', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='logs',
|
||||||
|
name='user',
|
||||||
|
field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='logs',
|
||||||
|
name='date',
|
||||||
|
field=models.DateTimeField(auto_now=True),
|
||||||
|
preserve_default=True,
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,11 +1,12 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from instances.models import Instance
|
from instances.models import Instance
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
class Logs(models.Model):
|
class Logs(models.Model):
|
||||||
|
user = models.ForeignKey(User)
|
||||||
instance = models.ForeignKey(Instance)
|
instance = models.ForeignKey(Instance)
|
||||||
message = models.CharField(max_length=255)
|
message = models.CharField(max_length=255)
|
||||||
date = models.DateTimeField()
|
date = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.instance
|
return self.instance
|
|
@ -16,6 +16,6 @@ def showlogs(request):
|
||||||
if not request.user.is_superuser:
|
if not request.user.is_superuser:
|
||||||
return HttpResponseRedirect(reverse('index'))
|
return HttpResponseRedirect(reverse('index'))
|
||||||
|
|
||||||
|
logs = Logs.objects.all()
|
||||||
|
|
||||||
return render(request, 'showlogs.html', locals())
|
return render(request, 'showlogs.html', locals())
|
|
@ -13,5 +13,40 @@
|
||||||
{% include 'errors_block.html' %}
|
{% include 'errors_block.html' %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
{% if not logs %}
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="alert alert-warning alert-dismissable">
|
||||||
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||||
|
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "You don't have any Logs" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<th>{% trans "User" %}</th>
|
||||||
|
<th>{% trans "Instance" %}</th>
|
||||||
|
<th>{% trans "Message" %}</th>
|
||||||
|
<th>{% trans "Date" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for log in logs %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ forloop.counter }}</td>
|
||||||
|
<td><a href="#">{{ log.user }}</a></td>
|
||||||
|
<td><a href="#">{{ log.instance }}<a></td>
|
||||||
|
<td>{{ log.message }}</td>
|
||||||
|
<td>{{ log.date }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in a new issue