Final structure

This commit is contained in:
Arnold Dechamps 2024-06-02 01:04:57 +02:00
parent 32ce80e3b4
commit b53e7bc62c
No known key found for this signature in database
GPG key ID: AE66543374E41C89
3 changed files with 18 additions and 2 deletions

View file

@ -58,6 +58,7 @@ def webrequest(tld, stack):
measurement = None
dbwriter(tld, stack, measurement)
def dbwriter(unicodetld, stack, measurement):
tld = Atlas.objects.filter(unicodetld=unicodetld)
tldstack = tld.filter(stack=stack)
@ -70,6 +71,18 @@ def dbwriter(unicodetld, stack, measurement):
db.stack = stack
db.measurement = measurement
db.save()
tld = TLD.objects.filter(unicodetld=unicodetld)
if tld.exists():
primary_key = tld.values_list('pk', flat=True).first()
db = TLD.objects.get(pk=primary_key)
if stack == 4:
db.atlasv4 = measurement
db.save()
elif stack == 6:
db.atlasv6 = measurement
db.save()
else:
print("Unknown IP version")
def main():
@ -83,5 +96,6 @@ def main():
webrequest(tld, 4)
webrequest(tld, 6)
if __name__ == "__main__":
main()
main()

View file

@ -7,7 +7,7 @@ import threading
class tlds(ExtraButtonsMixin, admin.ModelAdmin):
list_display = ('tld', 'nsamount', 'v4nsamount', 'v6nsamount', 'dnssec', 'lastEdition')
list_display = ('tld', 'nsamount', 'v4nsamount', 'v6nsamount', 'dnssec', 'atlasv4', 'atlasv6', 'lastEdition')
@button(change_form=True, html_attrs={'style': 'background-color:#88FF88;color:black'})
def refresh(self, request):

View file

@ -39,6 +39,8 @@ class TLD(models.Model):
organisation = models.CharField(max_length=100)
rdap = models.CharField(max_length=10, default="No")
link = models.CharField(max_length=800, default="https://tldtest.net/")
atlasv4 = models.IntegerField(default=0, blank=True, null=True)
atlasv6 = models.IntegerField(default=0, blank=True, null=True)
def __str__(self):
return self.tld