rakkapy/main/models.py

31 lines
875 B
Python

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)
proto=models.CharField(max_length=100)
comment=models.CharField(max_length=100)
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()