17 lines
575 B
Python
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)
|