15 changed files with 388 additions and 116 deletions
-
129abonapp/locale/ru/LC_MESSAGES/django.po
-
11abonapp/views.py
-
3accounts_app/admin.py
-
142accounts_app/locale/ru/LC_MESSAGES/django.po
-
45accounts_app/migrations/0003_new_user_profile_log.py
-
56accounts_app/models.py
-
29accounts_app/templates/accounts/action_log.html
-
11accounts_app/templates/accounts/ext.htm
-
4accounts_app/urls.py
-
32accounts_app/views.py
-
1devapp/forms.py
-
12devapp/views.py
-
2msg_app/templates/msg_app/chat.html
-
10nas_app/views.py
-
15tariff_app/views.py
@ -1,5 +1,6 @@ |
|||
from django.contrib import admin |
|||
|
|||
from .models import UserProfile |
|||
from .models import UserProfile, UserProfileLog |
|||
|
|||
admin.site.register(UserProfile) |
|||
admin.site.register(UserProfileLog) |
|||
@ -0,0 +1,45 @@ |
|||
# Generated by Django 2.1 on 2018-08-26 19:52 |
|||
|
|||
from django.conf import settings |
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
import jsonfield.fields |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('accounts_app', '0002_auto_20180807_1548'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='UserProfileLog', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('meta_info', jsonfield.fields.JSONField(default=dict, verbose_name='Meta information')), |
|||
('do_type', models.CharField(choices=[('cusr', 'Create user'), ('dusr', 'Delete user'), ('cdev', 'Create device'), ('ddev', 'Delete device'), ('cnas', 'Create NAS'), ('dnas', 'Delete NAS'), ('csrv', 'Create service'), ('dsrv', 'Delete service')], max_length=4, verbose_name='Action type')), |
|||
('additional_text', models.CharField(blank=True, null=True, verbose_name='Additional info', max_length=512)), |
|||
('action_date', models.DateTimeField(auto_now_add=True, verbose_name='Action date')), |
|||
], |
|||
options={ |
|||
'verbose_name': 'User profile log', |
|||
'verbose_name_plural': 'User profile logs', |
|||
'ordering': ('-action_date',), |
|||
}, |
|||
), |
|||
migrations.AlterModelOptions( |
|||
name='userprofile', |
|||
options={'ordering': ('fio',), 'verbose_name': 'Staff account profile', 'verbose_name_plural': 'Staff account profiles'}, |
|||
), |
|||
migrations.AlterField( |
|||
model_name='userprofile', |
|||
name='avatar', |
|||
field=models.ImageField(blank=True, default=None, null=True, upload_to='user/avatar', verbose_name='Avatar'), |
|||
), |
|||
migrations.AddField( |
|||
model_name='userprofilelog', |
|||
name='account', |
|||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Author'), |
|||
), |
|||
] |
|||
@ -0,0 +1,29 @@ |
|||
{% extends request.is_ajax|yesno:'nullcont.htm,accounts/ext.htm' %} |
|||
{% load i18n %} |
|||
|
|||
{% block content %} |
|||
<div class="table-responsive"> |
|||
<table class="table table-striped table-bordered"> |
|||
<thead> |
|||
<tr> |
|||
<th>{% trans 'Date' %}</th> |
|||
<th>{% trans 'Additional' %}</th> |
|||
<th>{% trans 'Description' %}</th> |
|||
<th>{% trans 'Meta information' %}</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
{% for log in object_list %} |
|||
<tr> |
|||
<td>{{ log.action_date|date:'D d E Y H:i:s' }}</td> |
|||
<td>{{ log.additional_text|default_if_none:'-' }}</td> |
|||
<td>{{ log.get_do_type_display }}</td> |
|||
<td>{{ log.meta_info }}</td> |
|||
</tr> |
|||
{% empty %} |
|||
<tr><td colspan="4">{% trans 'That admin has no logs' %}</td></tr> |
|||
{% endfor %} |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
{% endblock %} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue