from django.db import models from datetime import date # Create your models here. class Page(models.Model): url=models.CharField(max_length=500) title=models.CharField(max_length=100) contents=models.TextField() last_edited=models.DateField(auto_now=True) def __str__(self): return self.title class Contact(models.Model): name=models.CharField(max_length=100) url=models.CharField(max_length=500,null=True) proto=models.CharField(max_length=100) comment=models.CharField(max_length=100,blank=True) group=models.IntegerField(choices=list({0:'Preferred',1:'Suitable',2:'Discouraged',3:'Ignored',4:'Discontinued',5:'NSFW'}.items())) priority=models.IntegerField() def save(self,*args,**kwargs): a,_=Updates.objects.get_or_create(page='contact') a.date=date.today() a.save() super().save(*args,**kwargs) def __str__(self): return self.proto+': '+self.name class Updates(models.Model): page=models.CharField(max_length=100) date=models.DateField()