##// END OF EJS Templates
Moved signature set to global id, not post
Moved signature set to global id, not post

File last commit:

r1234:730ce4d2 decentral
r1242:b72fba6e decentral
Show More
user.py
45 lines | 1014 B | text/x-python | PythonLexer
neko259
Split up user models
r386 from django.db import models
neko259
Split post module into post and manager
r1234 import boards
neko259
Added notification API
r994
neko259
Split up user models
r386 __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)
neko259
Made ban object show IP in 'str' method instead of 'unicode' which was user...
r798 def __str__(self):
neko259
Split up user models
r386 return self.ip
neko259
User notifications (BB-59)
r990
neko259
Added notification API
r994 class NotificationManager(models.Manager):
def get_notification_posts(self, username: str, last: int = None):
neko259
Use only lowercase name in notifications. Refactored post manager and refmap...
r1008 i_username = username.lower()
posts = boards.models.post.Post.objects.filter(notification__name=i_username)
neko259
Added notification API
r994 if last is not None:
posts = posts.filter(id__gt=last)
posts = posts.order_by('-id')
return posts
neko259
User notifications (BB-59)
r990 class Notification(models.Model):
class Meta:
app_label = 'boards'
neko259
Added notification API
r994 objects = NotificationManager()
neko259
User notifications (BB-59)
r990 post = models.ForeignKey('Post')
name = models.TextField()