-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
3,822 additions
and
2,915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ tardis/apps/* | |
!tardis/apps/sftp | ||
!tardis/apps/social_auth | ||
!tardis/apps/search | ||
|
||
!tardis/apps/eventlog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Sphinx==3.2.1 | ||
Sphinx==3.3.0 | ||
sphinx-rtd-theme==0.5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
psycopg2-binary==2.8.5 | ||
psycopg2-binary==2.8.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
behave_django==1.4.0 | ||
coverage==5.2 | ||
coverage==5.3 | ||
django-coverage-plugin==1.8.0 | ||
django-nose==1.4.6 | ||
django-nose==1.4.7 | ||
flexmock==0.10.4 | ||
nose==1.3.7 | ||
pylint==2.5.3 | ||
pylint-django==2.1.0 | ||
pylint==2.6.0 | ||
pylint-django==2.3.0 | ||
selenium==3.141.0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from django.contrib import admin | ||
|
||
from .models import Log | ||
|
||
|
||
class LogAdmin(admin.ModelAdmin): | ||
raw_id_fields = ["user"] | ||
list_filter = ["action__name", "timestamp"] | ||
list_display = ["timestamp", "user", "action", "extra"] | ||
search_fields = ["user__username", "user__email", "extra"] | ||
|
||
|
||
admin.site.register(Log, LogAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ENABLE_EVENTLOG = False | ||
EVENTLOG_ACTIONS = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import json | ||
|
||
from django.db.models import Field | ||
|
||
|
||
class JSONField(Field): | ||
""" | ||
Simple class to make `JSONField` available to sqlite backends. | ||
""" | ||
|
||
def db_type(self, connection): | ||
return "text" | ||
|
||
def from_db_value(self, value, expression, connection): | ||
if value is not None: | ||
return self.to_python(value) | ||
return value | ||
|
||
def to_python(self, value): | ||
if value is not None: | ||
try: | ||
return json.loads(value) | ||
except (TypeError, ValueError): | ||
return value | ||
return value | ||
|
||
def get_prep_value(self, value): | ||
if value is not None: | ||
return str(json.dumps(value)) | ||
return value | ||
|
||
def value_to_string(self, obj): | ||
return self.value_from_object(obj) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 2.2.14 on 2020-07-18 06:27 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.utils.timezone | ||
|
||
from django.core.serializers.json import DjangoJSONEncoder | ||
|
||
# pylint: disable=C0412 | ||
if "sqlite" in settings.DATABASES["default"]["ENGINE"]: | ||
from ..fields import JSONField | ||
elif "mysql" in settings.DATABASES["default"]["ENGINE"]: | ||
# pylint: disable=E0401 | ||
from django_mysql.models import JSONField | ||
else: | ||
from django.contrib.postgres.fields import JSONField | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('contenttypes', '0002_remove_content_type_name'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Action', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=64)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Log', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('timestamp', models.DateTimeField(db_index=True, default=django.utils.timezone.now)), | ||
('action', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eventlog.Action')), | ||
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)), | ||
('content_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='contenttypes.ContentType')), | ||
('object_id', models.PositiveIntegerField(null=True)), | ||
('extra', JSONField(verbose_name=DjangoJSONEncoder)), | ||
], | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from django.conf import settings | ||
from django.db import models | ||
from django.utils import timezone | ||
from django.contrib.contenttypes.fields import GenericForeignKey | ||
from django.contrib.contenttypes.models import ContentType | ||
from django.contrib.auth.models import User | ||
from django.core.serializers.json import DjangoJSONEncoder | ||
|
||
# pylint: disable=C0412 | ||
if "sqlite" in settings.DATABASES["default"]["ENGINE"]: | ||
from .fields import JSONField | ||
elif "mysql" in settings.DATABASES["default"]["ENGINE"]: | ||
# pylint: disable=E0401 | ||
from django_mysql.models import JSONField | ||
else: | ||
from django.contrib.postgres.fields import JSONField | ||
|
||
|
||
class Action(models.Model): | ||
name = models.CharField(max_length=64) | ||
|
||
def __str__(self): | ||
return self.name | ||
|
||
|
||
class Log(models.Model): | ||
class Meta: | ||
ordering = ["-timestamp"] | ||
|
||
timestamp = models.DateTimeField(null=False, default=timezone.now, db_index=True) | ||
action = models.ForeignKey(Action, on_delete=models.CASCADE) | ||
user = models.ForeignKey(User, null=True, on_delete=models.SET_NULL) | ||
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL) | ||
object_id = models.PositiveIntegerField(null=True) | ||
obj = GenericForeignKey("content_type", "object_id") | ||
extra = JSONField(DjangoJSONEncoder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import django.dispatch | ||
|
||
|
||
event_logged = django.dispatch.Signal(providing_args=["event"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
urlpatterns = [] |
Oops, something went wrong.