User created communities are now sorted by posts. Some small bug fixes, changed lazy error messages.
This commit is contained in:
some weird guy
2023-08-09 12:37:48 -07:00
parent dbe93afb76
commit 46844a7cfb
5 changed files with 25 additions and 14 deletions
+6 -1
View File
@@ -143,6 +143,7 @@ class User(models.Model):
user_agent = models.TextField(null=True, blank=True)
# C Tokens are things that let you make communities and shit.
c_tokens = models.IntegerField(default=1)
protect_data = models.BooleanField(default=False)
# Things that don't have to do with auth lol
hide_online = models.BooleanField(default=False)
@@ -639,7 +640,11 @@ class Community(models.Model):
objects = PostManager()
real = models.Manager()
def popularity(self):
popularity = Post.objects.filter(community=self).count()
if self.creator:
# don't count posts from the community owner.
popularity = Post.objects.filter(community=self).exclude(creator=self.creator).count()
else:
popularity = Post.objects.filter(community=self).count()
return popularity
def __str__(self):
return self.name