Skip to content

Commit

Permalink
feat: add searching functionality in FAQ and add index to sorted m2m …
Browse files Browse the repository at this point in the history
…field (#4499)
  • Loading branch information
AfaqShuaib09 authored Nov 29, 2024
1 parent 9c392ea commit f2ee31d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion course_discovery/apps/course_metadata/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,8 @@ class CorporateEndorsementAdmin(admin.ModelAdmin):

@admin.register(FAQ)
class FAQAdmin(admin.ModelAdmin):
list_display = ('question',)
list_display = ('id', 'question', 'answer')
search_fields = ('id', 'question',)


@admin.register(Ranking)
Expand Down
2 changes: 1 addition & 1 deletion course_discovery/apps/course_metadata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3192,7 +3192,7 @@ class Meta:
ordering = ['created']

def __str__(self):
return self.question
return f'{self.pk}: {self.question}'


class Program(ManageHistoryMixin, PkSearchableMixin, TimeStampedModel):
Expand Down
2 changes: 1 addition & 1 deletion course_discovery/apps/course_metadata/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3802,7 +3802,7 @@ class FAQTests(TestCase):
def test_str(self):
question = 'test question'
faq = FAQ.objects.create(question=question, answer='test')
assert str(faq) == question
assert str(faq) == f'{faq.id}: {faq.question}'


class RankingTests(TestCase):
Expand Down

0 comments on commit f2ee31d

Please sign in to comment.