Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
course-discovery
Commits
2d50e7ba
Commit
2d50e7ba
authored
Jul 18, 2016
by
Clinton Blackburn
Committed by
GitHub
Jul 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added content_type field to programs search results (#165)
parent
d8040e67
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
course_discovery/apps/api/serializers.py
+6
-2
course_discovery/apps/api/tests/test_serializers.py
+1
-0
No files found.
course_discovery/apps/api/serializers.py
View file @
2d50e7ba
...
...
@@ -44,6 +44,10 @@ COURSE_RUN_SEARCH_FIELDS = (
'image_url'
,
'type'
,
'text'
,
)
PROGRAM_SEARCH_FIELDS
=
(
'uuid'
,
'name'
,
'subtitle'
,
'category'
,
'marketing_url'
,
'organizations'
,
'content_type'
,
'text'
,
)
def
get_marketing_url_for_user
(
user
,
marketing_url
):
"""
...
...
@@ -495,7 +499,7 @@ class CourseRunFacetSerializer(BaseHaystackFacetSerializer):
class
ProgramSearchSerializer
(
HaystackSerializer
):
class
Meta
:
field_aliases
=
COMMON_SEARCH_FIELD_ALIASES
fields
=
(
'uuid'
,
'name'
,
'subtitle'
,
'category'
,
'marketing_url'
,
'organizations'
,
'text'
,)
fields
=
PROGRAM_SEARCH_FIELDS
ignore_fields
=
COMMON_IGNORED_FIELDS
index_classes
=
[
ProgramIndex
]
...
...
@@ -505,7 +509,7 @@ class ProgramFacetSerializer(BaseHaystackFacetSerializer):
class
Meta
:
field_aliases
=
COMMON_SEARCH_FIELD_ALIASES
fields
=
(
'uuid'
,
'name'
,
'subtitle'
,
'category'
,
'marketing_url'
,
'organizations'
,
'text'
,)
fields
=
PROGRAM_SEARCH_FIELDS
ignore_fields
=
COMMON_IGNORED_FIELDS
index_classes
=
[
ProgramIndex
]
...
...
course_discovery/apps/api/tests/test_serializers.py
View file @
2d50e7ba
...
...
@@ -397,5 +397,6 @@ class ProgramSearchSerializerTests(TestCase):
'category'
:
program
.
category
,
'marketing_url'
:
program
.
marketing_url
,
'organizations'
:
[
OrganizationsMixin
.
format_organization
(
organization
)],
'content_type'
:
'program_{category}'
.
format
(
category
=
program
.
category
),
}
self
.
assertDictEqual
(
serializer
.
data
,
expected
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment