diff --git a/main/models.py b/main/models.py index 2954cc8..2c05d2e 100644 --- a/main/models.py +++ b/main/models.py @@ -1,4 +1,5 @@ from django.db import models +from datetime import date # Create your models here. @@ -16,5 +17,15 @@ class Contact(models.Model): url=models.CharField(max_length=500) proto=models.CharField(max_length=100) comment=models.CharField(max_length=100) - group=models.CharField(max_length=100) - priority=models.IntegerField() \ No newline at end of file + 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() \ No newline at end of file diff --git a/main/views.py b/main/views.py index e5b655d..751418c 100644 --- a/main/views.py +++ b/main/views.py @@ -4,7 +4,7 @@ from django.template import loader import random as ra import asyncio from . import mdl -from .models import Page +from .models import Page, Contact, Updates import functools @@ -71,7 +71,7 @@ def contact(): out2+='\n'.join([lii(*l) for l in v]) out2+="\n

" out3+=out2 - return {'title':'Contact','content':head+out3,'date':'2021/08/13'} + return {'title':'Contact','content':head+out3,'date':Updates.objects.get(page='contact').date} def specs(req): with open('main/pages/specs') as b: @@ -124,6 +124,7 @@ NOTE:Anti-professionalism, pro-open standards CATEGORIES:programmer,biker SOURCE:https://rakka.tk/me.vcf END:VCARD""") + @rerender def autopage(page): p=Page.objects.get(url=page)