@@ -16,7 +16,7 @@ This application enables you to create and manage follows, blocks and bi-directi
1616
1717Django 4.2, 5.1, and 5.2 + Python 3.9, 3.10, 3.11, 3.12, and 3.13 support added ** >v1.9.6**
1818
19- Previously:
19+ Previously:
2020
2121- ** Django 3.2 since v1.9.1**
2222- ** Django 1.11+** since v1.7.0 (latest release supporting ** Django 1.10** is v1.6.0)
@@ -29,9 +29,8 @@ Previously:
2929
3030``` python
3131urlpatterns = [
32- ...
33- path(' friendship/' , include(' friendship.urls' ))
34- ...
32+ # other paths
33+ path(" friendship/" , include(" friendship.urls" ))
3534]
3635```
3736
@@ -87,17 +86,20 @@ from friendship.models import Friend, Follow, Block
8786``` python
8887other_user = User.objects.get(pk = 1 )
8988Friend.objects.add_friend(
90- request.user, # The sender
91- other_user, # The recipient
92- message = ' Hi! I would like to add you' ) # This message is optional
89+ request.user, # The sender
90+ other_user, # The recipient
91+ message = " Hi! I would like to add you" ,
92+ ) # This message is optional
9393```
9494
9595#### Let the user who received the request respond:
9696
9797``` python
9898from friendship.models import FriendshipRequest
9999
100- friend_request = FriendshipRequest.objects.get(from_user = request.user, to_user = other_user)
100+ friend_request = FriendshipRequest.objects.get(
101+ from_user = request.user, to_user = other_user
102+ )
101103friend_request.accept()
102104# or friend_request.reject()
103105```
@@ -167,9 +169,11 @@ Then use any of the following:
167169` django-friendship ` supports the following settings:
168170
169171``` python
170- FRIENDSHIP_CONTEXT_OBJECT_NAME = ' user'
171- FRIENDSHIP_CONTEXT_OBJECT_LIST_NAME = ' users'
172- FRIENDSHIP_MANAGER_FRIENDSHIP_REQUEST_SELECT_RELATED_STRATEGY = ' select_related' # ('select_related', 'prefetch_related', 'none')
172+ FRIENDSHIP_CONTEXT_OBJECT_NAME = " user"
173+ FRIENDSHIP_CONTEXT_OBJECT_LIST_NAME = " users"
174+ FRIENDSHIP_MANAGER_FRIENDSHIP_REQUEST_SELECT_RELATED_STRATEGY = (
175+ " select_related" # ('select_related', 'prefetch_related', 'none')
176+ )
173177```
174178
175179### Contributing
0 commit comments