clean app
This commit is contained in:
parent
9008ba2c18
commit
19173d1e0c
@ -26,9 +26,10 @@ def can_complete_note(user, note):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return (
|
return (
|
||||||
is_admin(user)
|
(note.is_public and not note.recipients.exists())
|
||||||
|
or is_admin(user)
|
||||||
or note.author_id == user.id
|
or note.author_id == user.id
|
||||||
or note.recipients.filter(
|
or note.recipients.filter(
|
||||||
pk=user.pk,
|
pk=user.pk,
|
||||||
).exists()
|
).exists()
|
||||||
)
|
)
|
||||||
|
|||||||
@ -145,4 +145,4 @@ class NoteSerializer(serializers.ModelSerializer):
|
|||||||
class NoteCompletionSerializer(
|
class NoteCompletionSerializer(
|
||||||
serializers.Serializer,
|
serializers.Serializer,
|
||||||
):
|
):
|
||||||
is_done = serializers.BooleanField()
|
is_done = serializers.BooleanField()
|
||||||
|
|||||||
@ -113,7 +113,8 @@ class NoteListView(
|
|||||||
|
|
||||||
elif scope == 'to_me':
|
elif scope == 'to_me':
|
||||||
notes = notes.filter(
|
notes = notes.filter(
|
||||||
recipients=self.request.user,
|
Q(is_public=True, recipients__isnull=True)
|
||||||
|
| Q(recipients=self.request.user),
|
||||||
)
|
)
|
||||||
|
|
||||||
elif scope != 'all':
|
elif scope != 'all':
|
||||||
@ -317,4 +318,4 @@ class NoteRecipientListView(
|
|||||||
'last_name',
|
'last_name',
|
||||||
'username',
|
'username',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user