This repository has been archived on 2023-02-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-my-data/mydata_benchmarks/models.py
Sybren A. Stüvel f2cdc2d588 Use strings (instead of UUIDs) for Benchmark ID and manage_id
Also added little happy-flow unit test for benchmark submission
2018-08-09 13:45:19 +02:00

29 lines
1.2 KiB
Python

from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
from django.db import models
class Benchmark(models.Model):
"""The result of a benchmark run on the Benchmark Client."""
user = models.ForeignKey(User, on_delete=models.CASCADE, blank=False, related_name='benchmarks')
benchmark_id = models.CharField(max_length=48, editable=False, db_index=True)
manage_id = models.CharField(max_length=48, editable=False)
date_created = models.DateTimeField(auto_now_add=True)
data_raw = JSONField(editable=False) # The original result of a benchmark
class Meta:
ordering = ('date_created',)
class ClientToken(models.Model):
"""Used by Benchmark Client to submit data as a User."""
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='client_tokens')
token = models.CharField(max_length=200, db_index=True)
hostname = models.CharField(max_length=100, blank=True) # The hostname of the Benchmark client
date_created = models.DateTimeField(auto_now_add=True)
is_valid = models.BooleanField(default=True)
class Meta:
ordering = ('date_created',)
verbose_name = 'Client Token'