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) renders=models.BooleanField(default=True) def __str__(self): return self.title class Contact(models.Model): name=models.CharField(max_length=100) url=models.CharField(max_length=500,blank=True) proto=models.CharField(max_length=100) comment=models.CharField(max_length=100,blank=True) groups={0:'Preferred',1:'Suitable',2:'Discouraged',3:'Ignored',4:'Discontinued',5:'NSFW'} group=models.IntegerField(choices=list(groups.items())) priority=models.IntegerField() desktop=models.BooleanField(default=True) mobile=models.BooleanField(default=True) def save(self,*args,**kwargs): a,_=Update.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 Update(models.Model): page=models.CharField(max_length=100) date=models.DateField() class Redirect(models.Model): match=models.CharField(max_length=200) output=models.CharField(max_length=500)