Maybe finally got this thing right

This commit is contained in:
Zergling_man 2021-12-10 03:33:05 +11:00
parent 8cd49ce5e1
commit 6c8c9b69a7
2 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,5 @@
from django.db import models from django.db import models
from datetime import date
# Create your models here. # Create your models here.
@ -16,5 +17,15 @@ class Contact(models.Model):
url=models.CharField(max_length=500) url=models.CharField(max_length=500)
proto=models.CharField(max_length=100) proto=models.CharField(max_length=100)
comment=models.CharField(max_length=100) comment=models.CharField(max_length=100)
group=models.CharField(max_length=100) group=models.IntegerField(choices={0:'Preferred',1:'Suitable',2:'Discouraged',3:'Ignored',4:'Discontinued',5:'NSFW'})
priority=models.IntegerField() 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()

View File

@ -4,7 +4,7 @@ from django.template import loader
import random as ra import random as ra
import asyncio import asyncio
from . import mdl from . import mdl
from .models import Page from .models import Page, Contact, Updates
import functools import functools
@ -71,7 +71,7 @@ def contact():
out2+='\n'.join([lii(*l) for l in v]) out2+='\n'.join([lii(*l) for l in v])
out2+="\n</ul></p>" out2+="\n</ul></p>"
out3+=out2 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): def specs(req):
with open('main/pages/specs') as b: with open('main/pages/specs') as b:
@ -124,6 +124,7 @@ NOTE:Anti-professionalism, pro-open standards
CATEGORIES:programmer,biker CATEGORIES:programmer,biker
SOURCE:https://rakka.tk/me.vcf SOURCE:https://rakka.tk/me.vcf
END:VCARD""") END:VCARD""")
@rerender @rerender
def autopage(page): def autopage(page):
p=Page.objects.get(url=page) p=Page.objects.get(url=page)