Skip to content

Commit

Permalink
chore(fix): Updated article_serializer with list display sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
happychuks committed Aug 14, 2024
1 parent ba86849 commit 86d19c4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion server/apps/research/serializers/article_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ class ArticleSerializer(serializers.ModelSerializer):

class Meta:
model = Article
fields = '__all__'
fields = [
'id', 'slug', 'title', 'authors', 'thumb',
'categories', 'summary', 'content',
'status', 'views', 'created_at', 'updated_at'
]

class ArticleCreateUpdateSerializer(serializers.ModelSerializer):
"""Serializer for creating and updating articles."""
Expand Down
4 changes: 2 additions & 2 deletions server/apps/research/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_queryset(self):
return Article.objects.filter(status='ready')

# Custom action to retrieve articles by slug or UUID
@action(detail=False, methods=['get'], url_path='(?P<identifier>[-\w0-9a-fA-F]+)')
@action(detail=False, methods=['get'], url_path=r'(?P<identifier>[-\w0-9a-fA-F]+)')
def retrieve_by_identifier(self, request, identifier=None):
"""Retrieve an article by slug or UUID."""
try:
Expand All @@ -57,4 +57,4 @@ def is_valid_uuid(self, value):
uuid.UUID(value)
return True
except ValueError:
return False
return False
Binary file added server/media/icon_bed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added server/media/makeTea.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 86d19c4

Please sign in to comment.