##// END OF EJS Templates
Reflinks to OPs are bold now. Refactored reflinks to build using the same code. Refactored autoescaping
Reflinks to OPs are bold now. Refactored reflinks to build using the same code. Refactored autoescaping

File last commit:

r1234:730ce4d2 decentral
r1309:a2eaff61 default
Show More
user.py
46 lines | 1.0 KiB | text/x-python | PythonLexer
from django.db import models
import boards.models.post
__author__ = 'neko259'
BAN_REASON_AUTO = 'Auto'
BAN_REASON_MAX_LENGTH = 200
class Ban(models.Model):
class Meta:
app_label = 'boards'
ip = models.GenericIPAddressField()
reason = models.CharField(default=BAN_REASON_AUTO,
max_length=BAN_REASON_MAX_LENGTH)
can_read = models.BooleanField(default=True)
def __str__(self):
return self.ip
class NotificationManager(models.Manager):
def get_notification_posts(self, username: str, last: int = None):
i_username = username.lower()
posts = boards.models.post.Post.objects.filter(notification__name=i_username)
if last is not None:
posts = posts.filter(id__gt=last)
posts = posts.order_by('-id')
return posts
class Notification(models.Model):
class Meta:
app_label = 'boards'
objects = NotificationManager()
post = models.ForeignKey('Post')
name = models.TextField()