more
This commit is contained in:
parent
7f25dcf95c
commit
be4fbda2a6
@ -1,10 +1,29 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class Attachment(models.Model):
|
from . import util
|
||||||
pass
|
|
||||||
|
|
||||||
|
class Attachment(models.Model):
|
||||||
|
filename = models.CharField(max_length=256)
|
||||||
|
filepath = models.CharField(max_length=256)
|
||||||
|
width = models.IntegerField()
|
||||||
|
height = models.IntegerField()
|
||||||
|
|
||||||
class Post(models.Model):
|
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):
|
class Board(models.Model):
|
||||||
pass
|
pass
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
import hashlib
|
||||||
|
|
||||||
|
|
||||||
|
def hashid(msgid):
|
||||||
|
return hashlib.sha1().hexdigest('%s' % msgid).decode('ascii')
|
Reference in New Issue
Block a user