feat: Make notification counter display actual number of notifications
This commit is contained in:
parent
dda421e557
commit
79406882ea
@ -71,6 +71,9 @@ class User(AbstractUser):
|
|||||||
def get_notifications_url(self):
|
def get_notifications_url(self):
|
||||||
return self.get_absolute_url()
|
return self.get_absolute_url()
|
||||||
|
|
||||||
|
def get_num_unread_notifications(self):
|
||||||
|
return BaseNotification.objects.filter(user=self,read=False).count()
|
||||||
|
|
||||||
|
|
||||||
class Image(models.Model):
|
class Image(models.Model):
|
||||||
image = models.ImageField(upload_to='images')
|
image = models.ImageField(upload_to='images')
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<a href="{{ user.get_notifications_url }}">
|
<a href="{{ user.get_notifications_url }}">
|
||||||
<i class="fa fa-bell" aria-hidden="true"></i>
|
<i class="fa fa-bell" aria-hidden="true"></i>
|
||||||
</a>
|
</a>
|
||||||
<span class="button__badge">4</span>
|
<span class="button__badge">{{ user.get_num_unread_notifications }}</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user