Skip to content

Commit

Permalink
Merge dcc4639 into a84d0dc
Browse files Browse the repository at this point in the history
  • Loading branch information
xangcastle committed Oct 28, 2020
2 parents a84d0dc + dcc4639 commit 110ef9e
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
34 changes: 34 additions & 0 deletions error_tracker/django/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from .models import ErrorModel
from django.contrib import admin
from .settings import USE_DJANGO_ADMIN_SITE

if USE_DJANGO_ADMIN_SITE:
@admin.register(ErrorModel)
class ErrorModelAdmin(admin.ModelAdmin):
date_hierarchy = 'last_seen'
list_display = (
'host',
'path',
'method',
'exception_name',
'count',
'created_on',
'last_seen',
'notification_sent',
'ticket_raised',
)
list_filter = (
'host',
'notification_sent',
'ticket_raised',
)
search_fields = ('host', 'path', 'exception_name',)
change_form_template = 'error_tracker/admin/change_form.html'

def changeform_view(self, request, object_id=None, form_url='', extra_context=None):
if object_id:
extra_context = {
'obj': ErrorModel.objects.get(pk=object_id)
}
return super().changeform_view(request, object_id=object_id,
form_url=form_url, extra_context=extra_context)
2 changes: 2 additions & 0 deletions error_tracker/django/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ def get(key, default):
APP_ERROR_NOTIFICATION_ONCE = get('APP_ERROR_NOTIFICATION_ONCE', False)
# Raise ticket once
APP_ERROR_TICKET_ONCE = get('APP_ERROR_NOTIFICATION_ONCE', False)
# Use django admin site
USE_DJANGO_ADMIN_SITE = get('USE_DJANGO_ADMIN_SITE', False)

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends 'admin/change_form.html' %}


{% block content %}
{% include 'error_tracker/detail.html' %}
{% endblock %}
23 changes: 18 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
six
Flask
Flask-SQLAlchemy
Django
djangorestframework
asgiref==3.2.10
click==7.1.2
cssselect==1.1.0
Django==3.1.2
djangorestframework==3.12.1
Flask==1.1.2
Flask-SQLAlchemy==2.4.4
itsdangerous==1.1.0
Jinja2==2.11.2
lxml==4.6.1
MarkupSafe==1.1.1
pkg-resources==0.0.0
pyquery==1.4.1
pytz==2020.1
six==1.15.0
SQLAlchemy==1.3.20
sqlparse==0.4.1
Werkzeug==1.0.1

0 comments on commit 110ef9e

Please sign in to comment.