2021-09-18 21:37:18 +10:00
|
|
|
from django.db import models
|
2021-12-10 03:33:05 +11:00
|
|
|
from datetime import date
|
2021-09-18 21:37:18 +10:00
|
|
|
|
|
|
|
# Create your models here.
|
2021-10-09 20:36:50 +11:00
|
|
|
|
2021-10-09 20:58:50 +11:00
|
|
|
class Page(models.Model):
|
2021-10-09 20:36:50 +11:00
|
|
|
url=models.CharField(max_length=500)
|
|
|
|
title=models.CharField(max_length=100)
|
|
|
|
contents=models.TextField()
|
2021-10-09 23:33:21 +11:00
|
|
|
last_edited=models.DateField(auto_now=True)
|
2021-10-09 20:36:50 +11:00
|
|
|
|
|
|
|
def __str__(self):
|
2021-12-06 16:01:01 +11:00
|
|
|
return self.title
|
|
|
|
|
|
|
|
class Contact(models.Model):
|
|
|
|
name=models.CharField(max_length=100)
|
|
|
|
url=models.CharField(max_length=500)
|
|
|
|
proto=models.CharField(max_length=100)
|
|
|
|
comment=models.CharField(max_length=100)
|
2021-12-10 03:33:05 +11:00
|
|
|
group=models.IntegerField(choices={0:'Preferred',1:'Suitable',2:'Discouraged',3:'Ignored',4:'Discontinued',5:'NSFW'})
|
|
|
|
priority=models.IntegerField()
|
|
|
|
|
|
|
|
def save(self,*args,**kwargs):
|
|
|
|
a=Updates.objects.get(page='contact')
|
|
|
|
a.date=date.today()
|
|
|
|
a.save()
|
|
|
|
super().save(*args,**kwargs)
|
|
|
|
|
|
|
|
class Updates(models.Model):
|
|
|
|
page=models.CharField(max_length=100)
|
|
|
|
date=models.DateField()
|