Skip to content

Commit 4aef9f1

Browse files
committed
Add Link model to admin panel, fix PartnerProgramForMemberSerializer
1 parent d116031 commit 4aef9f1

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

core/admin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django.contrib import admin
2-
from core.models import Like, View
2+
from core.models import Like, View, Link
33

44

55
@admin.register(Like)
@@ -12,3 +12,9 @@ class LikeAdmin(admin.ModelAdmin):
1212
class ViewAdmin(admin.ModelAdmin):
1313
list_display = ("id", "user", "content_type", "object_id", "content_object")
1414
list_display_links = ("id", "user", "content_type", "object_id", "content_object")
15+
16+
17+
@admin.register(Link)
18+
class LinkAdmin(admin.ModelAdmin):
19+
list_display = ("id", "link", "content_type", "object_id", "content_object")
20+
list_display_links = ("id", "link", "content_type", "object_id", "content_object")

partner_programs/serializers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def count_views(self, program):
6060

6161
def get_links(self, program):
6262
# TODO: add caching here at least every 5 minutes, otherwise this will be heavy load
63-
return get_links(program)
63+
# fixme: create LinksSerializer mb?
64+
return [link.link for link in get_links(program)]
6465

6566
def get_is_user_liked(self, obj):
6667
# fixme: copy-paste in every serializer...

0 commit comments

Comments
 (0)