Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
1d2bc6fd
Commit
1d2bc6fd
authored
Jul 27, 2015
by
Awais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ECOM-1807 Adding provider thumbnail url.
parent
0f94910d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
177 additions
and
3 deletions
+177
-3
openedx/core/djangoapps/credit/api/provider.py
+3
-1
openedx/core/djangoapps/credit/migrations/0017_auto__add_field_creditprovider_thumbnail_url.py
+158
-0
openedx/core/djangoapps/credit/models.py
+9
-0
openedx/core/djangoapps/credit/tests/test_api.py
+7
-2
No files found.
openedx/core/djangoapps/credit/api/provider.py
View file @
1d2bc6fd
...
...
@@ -87,6 +87,7 @@ def get_credit_provider_info(request, provider_id): # pylint: disable=unused-ar
<li>Sample instruction abc</li>
<li>Sample instruction xyz</li>
</ul>",
"thumbnail_url": "https://credit.example.com/logo.png"
}
"""
...
...
@@ -100,7 +101,8 @@ def get_credit_provider_info(request, provider_id): # pylint: disable=unused-ar
"provider_status_url"
:
credit_provider
.
provider_status_url
,
"provider_description"
:
credit_provider
.
provider_description
,
"enable_integration"
:
credit_provider
.
enable_integration
,
"fulfillment_instructions"
:
credit_provider
.
fulfillment_instructions
"fulfillment_instructions"
:
credit_provider
.
fulfillment_instructions
,
"thumbnail_url"
:
credit_provider
.
thumbnail_url
}
return
JsonResponse
(
credit_provider_data
)
...
...
openedx/core/djangoapps/credit/migrations/0017_auto__add_field_creditprovider_thumbnail_url.py
0 → 100644
View file @
1d2bc6fd
# -*- coding: utf-8 -*-
from
south.utils
import
datetime_utils
as
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Adding field 'CreditProvider.thumbnail_url'
db
.
add_column
(
'credit_creditprovider'
,
'thumbnail_url'
,
self
.
gf
(
'django.db.models.fields.URLField'
)(
default
=
''
,
max_length
=
255
),
keep_default
=
False
)
def
backwards
(
self
,
orm
):
# Deleting field 'CreditProvider.thumbnail_url'
db
.
delete_column
(
'credit_creditprovider'
,
'thumbnail_url'
)
models
=
{
'auth.group'
:
{
'Meta'
:
{
'object_name'
:
'Group'
},
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'80'
}),
'permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
})
},
'auth.permission'
:
{
'Meta'
:
{
'ordering'
:
"('content_type__app_label', 'content_type__model', 'codename')"
,
'unique_together'
:
"(('content_type', 'codename'),)"
,
'object_name'
:
'Permission'
},
'codename'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'content_type'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'to'
:
"orm['contenttypes.ContentType']"
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
})
},
'auth.user'
:
{
'Meta'
:
{
'object_name'
:
'User'
},
'date_joined'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'email'
:
(
'django.db.models.fields.EmailField'
,
[],
{
'max_length'
:
'75'
,
'blank'
:
'True'
}),
'first_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'groups'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Group']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'is_active'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'is_staff'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'is_superuser'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'last_login'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'last_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'30'
,
'blank'
:
'True'
}),
'password'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'128'
}),
'user_permissions'
:
(
'django.db.models.fields.related.ManyToManyField'
,
[],
{
'to'
:
"orm['auth.Permission']"
,
'symmetrical'
:
'False'
,
'blank'
:
'True'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'30'
})
},
'contenttypes.contenttype'
:
{
'Meta'
:
{
'ordering'
:
"('name',)"
,
'unique_together'
:
"(('app_label', 'model'),)"
,
'object_name'
:
'ContentType'
,
'db_table'
:
"'django_content_type'"
},
'app_label'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'model'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
})
},
'credit.creditcourse'
:
{
'Meta'
:
{
'object_name'
:
'CreditCourse'
},
'course_key'
:
(
'xmodule_django.models.CourseKeyField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'255'
,
'db_index'
:
'True'
}),
'enabled'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
})
},
'credit.crediteligibility'
:
{
'Meta'
:
{
'unique_together'
:
"(('username', 'course'),)"
,
'object_name'
:
'CreditEligibility'
},
'course'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"'eligibilities'"
,
'to'
:
"orm['credit.CreditCourse']"
}),
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'deadline'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'default'
:
'datetime.datetime(2016, 7, 26, 0, 0)'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
,
'db_index'
:
'True'
})
},
'credit.creditprovider'
:
{
'Meta'
:
{
'object_name'
:
'CreditProvider'
},
'active'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'display_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
}),
'eligibility_email_message'
:
(
'django.db.models.fields.TextField'
,
[],
{
'default'
:
"''"
}),
'enable_integration'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'False'
}),
'fulfillment_instructions'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'provider_description'
:
(
'django.db.models.fields.TextField'
,
[],
{
'default'
:
"''"
}),
'provider_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'255'
}),
'provider_status_url'
:
(
'django.db.models.fields.URLField'
,
[],
{
'default'
:
"''"
,
'max_length'
:
'200'
}),
'provider_url'
:
(
'django.db.models.fields.URLField'
,
[],
{
'default'
:
"''"
,
'max_length'
:
'200'
}),
'receipt_email_message'
:
(
'django.db.models.fields.TextField'
,
[],
{
'default'
:
"''"
}),
'thumbnail_url'
:
(
'django.db.models.fields.URLField'
,
[],
{
'default'
:
"''"
,
'max_length'
:
'255'
})
},
'credit.creditrequest'
:
{
'Meta'
:
{
'unique_together'
:
"(('username', 'course', 'provider'),)"
,
'object_name'
:
'CreditRequest'
},
'course'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"'credit_requests'"
,
'to'
:
"orm['credit.CreditCourse']"
}),
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'parameters'
:
(
'jsonfield.fields.JSONField'
,
[],
{}),
'provider'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"'credit_requests'"
,
'to'
:
"orm['credit.CreditProvider']"
}),
'status'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'pending'"
,
'max_length'
:
'255'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
,
'db_index'
:
'True'
}),
'uuid'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'32'
,
'db_index'
:
'True'
})
},
'credit.creditrequirement'
:
{
'Meta'
:
{
'ordering'
:
"['order']"
,
'unique_together'
:
"(('namespace', 'name', 'course'),)"
,
'object_name'
:
'CreditRequirement'
},
'active'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'course'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"'credit_requirements'"
,
'to'
:
"orm['credit.CreditCourse']"
}),
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'criteria'
:
(
'jsonfield.fields.JSONField'
,
[],
{}),
'display_name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"''"
,
'max_length'
:
'255'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
}),
'namespace'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
}),
'order'
:
(
'django.db.models.fields.PositiveIntegerField'
,
[],
{
'default'
:
'0'
})
},
'credit.creditrequirementstatus'
:
{
'Meta'
:
{
'unique_together'
:
"(('username', 'requirement'),)"
,
'object_name'
:
'CreditRequirementStatus'
},
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'reason'
:
(
'jsonfield.fields.JSONField'
,
[],
{
'default'
:
'{}'
}),
'requirement'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"'statuses'"
,
'to'
:
"orm['credit.CreditRequirement']"
}),
'status'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
,
'db_index'
:
'True'
})
},
'credit.historicalcreditrequest'
:
{
'Meta'
:
{
'ordering'
:
"(u'-history_date', u'-history_id')"
,
'object_name'
:
'HistoricalCreditRequest'
},
'course'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"u'+'"
,
'null'
:
'True'
,
'on_delete'
:
'models.DO_NOTHING'
,
'to'
:
"orm['credit.CreditCourse']"
}),
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
u'history_date'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{}),
u'history_id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
u'history_type'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'1'
}),
u'history_user'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"u'+'"
,
'null'
:
'True'
,
'on_delete'
:
'models.SET_NULL'
,
'to'
:
"orm['auth.User']"
}),
'id'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'db_index'
:
'True'
,
'blank'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'parameters'
:
(
'jsonfield.fields.JSONField'
,
[],
{}),
'provider'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"u'+'"
,
'null'
:
'True'
,
'on_delete'
:
'models.DO_NOTHING'
,
'to'
:
"orm['credit.CreditProvider']"
}),
'status'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'pending'"
,
'max_length'
:
'255'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
,
'db_index'
:
'True'
}),
'uuid'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
,
'db_index'
:
'True'
})
},
'credit.historicalcreditrequirementstatus'
:
{
'Meta'
:
{
'ordering'
:
"(u'-history_date', u'-history_id')"
,
'object_name'
:
'HistoricalCreditRequirementStatus'
},
'created'
:
(
'model_utils.fields.AutoCreatedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
u'history_date'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{}),
u'history_id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
u'history_type'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'1'
}),
u'history_user'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"u'+'"
,
'null'
:
'True'
,
'on_delete'
:
'models.SET_NULL'
,
'to'
:
"orm['auth.User']"
}),
'id'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'db_index'
:
'True'
,
'blank'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'reason'
:
(
'jsonfield.fields.JSONField'
,
[],
{
'default'
:
'{}'
}),
'requirement'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'blank'
:
'True'
,
'related_name'
:
"u'+'"
,
'null'
:
'True'
,
'on_delete'
:
'models.DO_NOTHING'
,
'to'
:
"orm['credit.CreditRequirement']"
}),
'status'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
}),
'username'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'255'
,
'db_index'
:
'True'
})
}
}
complete_apps
=
[
'credit'
]
openedx/core/djangoapps/credit/models.py
View file @
1d2bc6fd
...
...
@@ -129,6 +129,14 @@ class CreditProvider(TimeStampedModel):
)
)
thumbnail_url
=
models
.
URLField
(
default
=
""
,
max_length
=
255
,
help_text
=
ugettext_lazy
(
"Thumbnail image url of the credit provider."
)
)
CREDIT_PROVIDERS_CACHE_KEY
=
"credit.providers.list"
@classmethod
...
...
@@ -166,6 +174,7 @@ class CreditProvider(TimeStampedModel):
"description"
:
provider
.
provider_description
,
"enable_integration"
:
provider
.
enable_integration
,
"fulfillment_instructions"
:
provider
.
fulfillment_instructions
,
"thumbnail_url"
:
provider
.
thumbnail_url
,
}
for
provider
in
credit_providers
]
...
...
openedx/core/djangoapps/credit/tests/test_api.py
View file @
1d2bc6fd
...
...
@@ -70,6 +70,7 @@ class CreditApiTestBase(ModuleStoreTestCase):
"mailing_address"
:
"123 Fake Street, Cambridge MA"
,
"country"
:
"US"
,
}
THUMBNAIL_URL
=
"https://credit.example.com/logo.png"
def
setUp
(
self
,
**
kwargs
):
super
(
CreditApiTestBase
,
self
)
.
setUp
()
...
...
@@ -86,7 +87,8 @@ class CreditApiTestBase(ModuleStoreTestCase):
provider_status_url
=
self
.
PROVIDER_STATUS_URL
,
provider_description
=
self
.
PROVIDER_DESCRIPTION
,
enable_integration
=
self
.
ENABLE_INTEGRATION
,
fulfillment_instructions
=
self
.
FULFILLMENT_INSTRUCTIONS
fulfillment_instructions
=
self
.
FULFILLMENT_INSTRUCTIONS
,
thumbnail_url
=
self
.
THUMBNAIL_URL
)
return
credit_course
...
...
@@ -516,7 +518,8 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
"status_url"
:
self
.
PROVIDER_STATUS_URL
,
"description"
:
self
.
PROVIDER_DESCRIPTION
,
"enable_integration"
:
self
.
ENABLE_INTEGRATION
,
"fulfillment_instructions"
:
self
.
FULFILLMENT_INSTRUCTIONS
"fulfillment_instructions"
:
self
.
FULFILLMENT_INSTRUCTIONS
,
"thumbnail_url"
:
self
.
THUMBNAIL_URL
}
])
...
...
@@ -540,6 +543,7 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
"description"
:
self
.
PROVIDER_DESCRIPTION
,
"enable_integration"
:
self
.
ENABLE_INTEGRATION
,
"fulfillment_instructions"
:
self
.
FULFILLMENT_INSTRUCTIONS
,
"thumbnail_url"
:
self
.
THUMBNAIL_URL
}]
result
=
api
.
get_credit_providers
([
self
.
PROVIDER_ID
])
self
.
assertEqual
(
result
,
expected_result
)
...
...
@@ -838,6 +842,7 @@ class CreditApiFeatureFlagEnabledTests(CreditApiFeatureFlagTest, CreditApiTestBa
"provider_description"
:
self
.
PROVIDER_DESCRIPTION
,
"enable_integration"
:
self
.
ENABLE_INTEGRATION
,
"fulfillment_instructions"
:
self
.
FULFILLMENT_INSTRUCTIONS
,
"thumbnail_url"
:
self
.
THUMBNAIL_URL
}
path
=
reverse
(
'credit:get_provider_info'
,
kwargs
=
{
'provider_id'
:
self
.
PROVIDER_ID
})
result
=
self
.
client
.
get
(
path
)
...
...
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