This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
logtracker/logtracker/collection/models.py

17 lines
575 B
Python

from django.db import models
from django.contrib.postgres.fields import JSONField
class Entry(models.Model):
host = models.CharField(max_length=128)
service = models.CharField(max_length=32)
priority = models.IntegerField(choices=[(0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5'), (6, '6'), (7, '7')], default=6)
timestamp = models.DateTimeField()
data = JSONField(blank=True)
class Meta:
ordering = ['-timestamp', '-id']
def __str__(self):
return '%s %s %s %s' % (self.timestamp, self.host, self.service, self.data)