Add /api/notes to get and post notes

This commit is contained in:
2025-12-07 15:11:49 +05:30
parent af343796d1
commit df595e4f19
10 changed files with 583 additions and 2 deletions

12
notes/api_views.py Normal file
View File

@@ -0,0 +1,12 @@
from django.utils import timezone
from rest_framework import generics
from notes.models import Note
from notes.serializers import NoteSerializer
class NoteListView(generics.ListCreateAPIView):
serializer_class = NoteSerializer
def get_queryset(self):
return Note.objects.filter(to_user=self.request.user, expiry__gt=timezone.now()).select_related("from_user", "to_user")