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
1cadc799
Commit
1cadc799
authored
Aug 13, 2016
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated Organization model
- Added marketing URL path - Added tags ECOM-5191
parent
33198721
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
3 deletions
+49
-3
course_discovery/apps/api/serializers.py
+4
-2
course_discovery/apps/api/tests/test_serializers.py
+3
-0
course_discovery/apps/course_metadata/migrations/0017_auto_20160815_2135.py
+31
-0
course_discovery/apps/course_metadata/models.py
+4
-0
course_discovery/settings/base.py
+5
-1
requirements/base.txt
+2
-0
No files found.
course_discovery/apps/api/serializers.py
View file @
1cadc799
...
...
@@ -7,6 +7,7 @@ from django.utils.translation import ugettext_lazy as _
from
drf_haystack.serializers
import
HaystackSerializer
,
HaystackFacetSerializer
from
rest_framework
import
serializers
from
rest_framework.fields
import
DictField
from
taggit_serializer.serializers
import
TagListSerializerField
,
TaggitSerializer
from
course_discovery.apps.catalogs.models
import
Catalog
from
course_discovery.apps.course_metadata.models
import
(
...
...
@@ -155,12 +156,13 @@ class PersonSerializer(serializers.ModelSerializer):
fields
=
(
'key'
,
'name'
,
'title'
,
'bio'
,
'profile_image'
,)
class
OrganizationSerializer
(
serializers
.
ModelSerializer
):
class
OrganizationSerializer
(
TaggitSerializer
,
serializers
.
ModelSerializer
):
"""Serializer for the ``Organization`` model."""
tags
=
TagListSerializerField
()
class
Meta
(
object
):
model
=
Organization
fields
=
(
'key'
,
'name'
,
'description'
,
'homepage_url'
,)
fields
=
(
'key'
,
'name'
,
'description'
,
'homepage_url'
,
'tags'
,
)
class
CatalogSerializer
(
serializers
.
ModelSerializer
):
...
...
course_discovery/apps/api/tests/test_serializers.py
View file @
1cadc799
...
...
@@ -387,6 +387,8 @@ class VideoSerializerTests(TestCase):
class
OrganizationSerializerTests
(
TestCase
):
def
test_data
(
self
):
organization
=
OrganizationFactory
()
TAG
=
'test'
organization
.
tags
.
add
(
TAG
)
serializer
=
OrganizationSerializer
(
organization
)
expected
=
{
...
...
@@ -394,6 +396,7 @@ class OrganizationSerializerTests(TestCase):
'name'
:
organization
.
name
,
'description'
:
organization
.
description
,
'homepage_url'
:
organization
.
homepage_url
,
'tags'
:
[
TAG
],
}
self
.
assertDictEqual
(
serializer
.
data
,
expected
)
...
...
course_discovery/apps/course_metadata/migrations/0017_auto_20160815_2135.py
0 → 100644
View file @
1cadc799
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
taggit.managers
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'taggit'
,
'0002_auto_20150616_2121'
),
(
'course_metadata'
,
'0016_auto_20160815_1438'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'historicalorganization'
,
name
=
'marketing_url_path'
,
field
=
models
.
CharField
(
null
=
True
,
max_length
=
255
,
blank
=
True
),
),
migrations
.
AddField
(
model_name
=
'organization'
,
name
=
'marketing_url_path'
,
field
=
models
.
CharField
(
null
=
True
,
max_length
=
255
,
blank
=
True
),
),
migrations
.
AddField
(
model_name
=
'organization'
,
name
=
'tags'
,
field
=
taggit
.
managers
.
TaggableManager
(
verbose_name
=
'Tags'
,
to
=
'taggit.Tag'
,
through
=
'taggit.TaggedItem'
,
help_text
=
'A comma-separated list of tags.'
,
blank
=
True
),
),
]
course_discovery/apps/course_metadata/models.py
View file @
1cadc799
...
...
@@ -14,6 +14,7 @@ from djchoices import DjangoChoices, ChoiceItem
from
haystack.query
import
SearchQuerySet
from
simple_history.models
import
HistoricalRecords
from
sortedm2m.fields
import
SortedManyToManyField
from
taggit.managers
import
TaggableManager
from
course_discovery.apps.core.models
import
Currency
,
Partner
from
course_discovery.apps.course_metadata.query
import
CourseQuerySet
...
...
@@ -156,11 +157,14 @@ class Organization(TimeStampedModel):
uuid
=
models
.
UUIDField
(
blank
=
False
,
null
=
False
,
default
=
uuid4
,
editable
=
False
,
verbose_name
=
_
(
'UUID'
))
key
=
models
.
CharField
(
max_length
=
255
)
name
=
models
.
CharField
(
max_length
=
255
)
marketing_url_path
=
models
.
CharField
(
max_length
=
255
,
null
=
True
,
blank
=
True
)
description
=
models
.
TextField
(
null
=
True
,
blank
=
True
)
homepage_url
=
models
.
URLField
(
max_length
=
255
,
null
=
True
,
blank
=
True
)
logo_image_url
=
models
.
URLField
(
null
=
True
,
blank
=
True
)
banner_image_url
=
models
.
URLField
(
null
=
True
,
blank
=
True
)
history
=
HistoricalRecords
()
tags
=
TaggableManager
(
blank
=
True
)
class
Meta
:
unique_together
=
(
...
...
course_discovery/settings/base.py
View file @
1cadc799
...
...
@@ -45,6 +45,9 @@ THIRD_PARTY_APPS = [
'django_filters'
,
'django_fsm'
,
'storages'
,
'django_comments'
,
'taggit'
,
'taggit_serializer'
,
]
PROJECT_APPS
=
[
...
...
@@ -56,7 +59,6 @@ PROJECT_APPS = [
'course_discovery.apps.edx_haystack_extensions'
,
'course_discovery.apps.publisher'
,
'course_discovery.apps.publisher_comments'
,
'django_comments'
,
]
...
...
@@ -359,3 +361,5 @@ DEFAULT_PARTNER_ID = None
# See: https://docs.djangoproject.com/en/dev/ref/settings/#site-id
SITE_ID
=
1
COMMENTS_APP
=
'course_discovery.apps.publisher_comments'
TAGGIT_CASE_INSENSITIVE
=
True
requirements/base.txt
View file @
1cadc799
...
...
@@ -12,6 +12,8 @@ django-libsass==0.7
django-simple-history==1.8.1
django-sortedm2m==1.3.2
django-storages==1.5.0
django-taggit==0.20.2
django-taggit-serializer==0.1.5
django-waffle==0.11.1
djangorestframework==3.3.3
djangorestframework-csv==1.4.1
...
...
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