index.community/scraper/models.py

23 lines
854 B
Python
Raw Normal View History

2018-08-26 00:32:55 +00:00
from django.db import models
class Instance(models.Model):
2018-08-26 01:17:10 +00:00
name = models.CharField(max_length=200, primary_key=True)
peers = models.ManyToManyField('self', symmetrical=False)
2018-08-28 22:22:29 +00:00
user_count = models.IntegerField(blank=True, null=True)
2018-08-26 00:32:55 +00:00
class InstanceStats(models.Model):
2018-08-28 22:22:29 +00:00
# TODO: collect everything the API exposes
2018-08-26 00:32:55 +00:00
timestamp = models.DateTimeField(auto_now_add=True)
instance = models.ForeignKey(
2018-08-26 01:17:10 +00:00
Instance,
2018-08-26 00:32:55 +00:00
on_delete=models.CASCADE,
2018-08-26 22:12:24 +00:00
related_name='stats',
2018-08-26 00:32:55 +00:00
)
2018-08-28 22:22:29 +00:00
domain_count = models.IntegerField(blank=True, null=True)
status_count = models.IntegerField(blank=True, null=True)
user_count = models.IntegerField(blank=True, null=True)
version = models.CharField(max_length=1000, blank=True) # In Django CharField is never stored as NULL in the db
2018-08-26 00:32:55 +00:00
status = models.CharField(max_length=100)