Archived
1
0
This commit is contained in:
Jeff Becker 2016-11-04 09:00:03 -04:00
parent 7f25dcf95c
commit be4fbda2a6
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
2 changed files with 27 additions and 3 deletions

View File

@ -1,10 +1,29 @@
from django.db import models
from . import util
class Attachment(models.Model):
pass
filename = models.CharField(max_length=256)
filepath = models.CharField(max_length=256)
width = models.IntegerField()
height = models.IntegerField()
class Post(models.Model):
pass
msgid = models.CharField(max_length=256, primary_key=True)
reference = models.CharField(max_length=256)
message = models.TextField()
subject = models.CharField(max_length=256)
name = models.CharField(max_length=256)
pubkey = models.CharField(max_length=64)
signature = models.CharField(max_length=64)
def get_absolute_url(self):
from django.urls import reverse
op = self.msgid
if self.reference != self.msgid:
op = self.reference
return reverse('frontend.views.threadpage', args=[util.hashid(op)])
class Board(models.Model):
pass

View File

@ -0,0 +1,5 @@
import hashlib
def hashid(msgid):
return hashlib.sha1().hexdigest('%s' % msgid).decode('ascii')