forked from mirrors/bookwyrm
parent
c6d887defe
commit
31f74c1a8c
2 changed files with 17 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
{% load fr_display %}
|
||||
{% if request.user|follow_request_exists:user %}
|
||||
<form action="/accept_follow_request/" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="user" value="{{ user.username }}">
|
||||
|
@ -8,3 +10,4 @@
|
|||
<input type="hidden" name="user" value="{{ user.username }}">
|
||||
<button type="submit" class="warning">Delete</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
|
|
@ -88,6 +88,20 @@ def get_user_liked(user, status):
|
|||
return False
|
||||
|
||||
|
||||
@register.filter(name='follow_request_exists')
|
||||
def follow_request_exists(user, requester):
|
||||
''' see if there is a pending follow request for a user '''
|
||||
try:
|
||||
models.UserFollowRequest.objects.filter(
|
||||
user_subject=requester,
|
||||
user_object=user,
|
||||
).get()
|
||||
return True
|
||||
except models.UserFollowRequest.DoesNotExist:
|
||||
return False
|
||||
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def shelve_button_identifier(context, book):
|
||||
''' check what shelf a user has a book on, if any '''
|
||||
|
|
Loading…
Reference in a new issue