11from __future__ import annotations
22
33from django .conf import settings
4- from django .contrib .admin .models import LogEntry
5- from django .contrib .contenttypes .models import ContentType
64from django .template .loader import render_to_string
75from django .urls import reverse
86from rest_framework import permissions , serializers
97from rest_framework .exceptions import ValidationError
8+ from django .utils import timezone
109
1110from core .api .serializers .custom import (
1211 CommentField ,
@@ -153,6 +152,10 @@ class AnnouncementProvider(BaseProvider):
153152 "tags" : [(int , "" ), (str , "name" )],
154153 "organization" : int ,
155154 "author" : int ,
155+ "last_modified_date__gt" : str ,
156+ "last_modified_date__gte" : str ,
157+ "last_modified_date__lt" : str ,
158+ "last_modified_date__lte" : str ,
156159 }
157160 raw_serializers = {
158161 "single" : OneSerializer ,
@@ -178,12 +181,11 @@ def get_last_modified(view):
178181
179182 @staticmethod
180183 def get_last_modified_queryset ():
181- return (
182- LogEntry .objects .filter (
183- content_type = ContentType .objects .get (
184- app_label = "core" , model = "announcement"
185- )
186- )
187- .latest ("action_time" )
188- .action_time
184+ last_modified_date = (
185+ Announcement .objects .all ().order_by ("-last_modified_date" , "id" ).first ()
189186 )
187+
188+ if last_modified_date :
189+ return last_modified_date .last_modified_date
190+ else :
191+ return timezone .now ()
0 commit comments