Skip to content

Instantly share code, notes, and snippets.

@eprueves
eprueves / models_snippet.py
Created August 2, 2019 06:09
test and datapoint DB models
class Test(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
agent = models.ForeignKey(AgentProfile, null=False, on_delete=models.CASCADE)
ip_address = models.GenericIPAddressField(null=False, protocol='IPv4') # ip address of agent when test was conducted
test_type = models.CharField(null=False, max_length=10, choices=choices.test_type_choices)
date_created = models.DateTimeField(auto_now_add=True)
network_connection = models.CharField(max_length=10, choices=choices.network_choices, default='unknown')
pcap = models.CharField(max_length=100, null=True)
lat = models.DecimalField(max_digits=10, decimal_places=7, default=16.647322)
long = models.DecimalField(max_digits=10, decimal_places=7, default=121.071959)