articles/views.py
def random_article_preview(self, request):
        """
        Fetch a random article for preview
        """
        article = Article.objects.filter(is_published=True).order_by('?').first()

        try:
            serializer = ArticlePreviewSerializer(article)
        except:
            return Response({}, status=404)
        else:
            return Response(serializer.data)

        Fetch a random article for preview
        
Fetch a random article for preview
Fetch a random article for preview
def random_article_preview(self, request):
        article = Article.objects.filter(is_published=True).order_by('?').first()
        try:
            serializer = ArticlePreviewSerializer(article)
        except:
            return Response({}, status=404)
        else:
            return Response(serializer.data)
def random_article_preview ( self , request ) : article = Article . objects . filter ( is_published = True ) . order_by ( '?' ) . first ( ) try : serializer = ArticlePreviewSerializer ( article ) except : return Response ( { } , status = 404 ) else : return Response ( serializer . data )
Fetch a random article for preview
Fetch a random article for preview
"""
        Fetch a random article for preview
        """
self
request