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
5f74a140
Commit
5f74a140
authored
May 28, 2015
by
Ahsan Ulhaq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up Credit Provider Model
Update credit Provider model and register in admin ECOM-1555
parent
60b73b48
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
3 deletions
+102
-3
openedx/core/djangoapps/credit/admin.py
+2
-2
openedx/core/djangoapps/credit/migrations/0005_auto__add_field_creditprovider_provider_url__add_field_creditprovider_.py
+90
-0
openedx/core/djangoapps/credit/models.py
+10
-1
No files found.
openedx/core/djangoapps/credit/admin.py
View file @
5f74a140
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Django admin page for credit eligibility
Django admin page for credit eligibility
"""
"""
from
ratelimitbackend
import
admin
from
ratelimitbackend
import
admin
from
.models
import
CreditCourse
from
.models
import
CreditCourse
,
CreditProvider
admin
.
site
.
register
(
CreditCourse
)
admin
.
site
.
register
(
CreditCourse
)
admin
.
site
.
register
(
CreditProvider
)
openedx/core/djangoapps/credit/migrations/0005_auto__add_field_creditprovider_provider_url__add_field_creditprovider_.py
0 → 100644
View file @
5f74a140
# -*- 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.provider_url'
db
.
add_column
(
'credit_creditprovider'
,
'provider_url'
,
self
.
gf
(
'django.db.models.fields.URLField'
)(
default
=
''
,
unique
=
True
,
max_length
=
255
),
keep_default
=
False
)
# Adding field 'CreditProvider.eligibility_duration'
db
.
add_column
(
'credit_creditprovider'
,
'eligibility_duration'
,
self
.
gf
(
'django.db.models.fields.PositiveIntegerField'
)(
default
=
0
),
keep_default
=
False
)
# Adding field 'CreditProvider.active'
db
.
add_column
(
'credit_creditprovider'
,
'active'
,
self
.
gf
(
'django.db.models.fields.BooleanField'
)(
default
=
True
),
keep_default
=
False
)
def
backwards
(
self
,
orm
):
# Deleting field 'CreditProvider.provider_url'
db
.
delete_column
(
'credit_creditprovider'
,
'provider_url'
)
# Deleting field 'CreditProvider.eligibility_duration'
db
.
delete_column
(
'credit_creditprovider'
,
'eligibility_duration'
)
# Deleting field 'CreditProvider.active'
db
.
delete_column
(
'credit_creditprovider'
,
'active'
)
models
=
{
'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'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'provider'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"'eligibilities'"
,
'to'
:
"orm['credit.CreditProvider']"
}),
'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_duration'
:
(
'django.db.models.fields.PositiveIntegerField'
,
[],
{}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified'
:
(
'model_utils.fields.AutoLastModifiedField'
,
[],
{
'default'
:
'datetime.datetime.now'
}),
'provider_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'255'
,
'db_index'
:
'True'
}),
'provider_url'
:
(
'django.db.models.fields.URLField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'255'
})
},
'credit.creditrequirement'
:
{
'Meta'
:
{
'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'
,
[],
{
'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'
})
},
'credit.creditrequirementstatus'
:
{
'Meta'
:
{
'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'
})
}
}
complete_apps
=
[
'credit'
]
\ No newline at end of file
openedx/core/djangoapps/credit/models.py
View file @
5f74a140
...
@@ -13,6 +13,7 @@ from django.db import models
...
@@ -13,6 +13,7 @@ from django.db import models
from
jsonfield.fields
import
JSONField
from
jsonfield.fields
import
JSONField
from
model_utils.models
import
TimeStampedModel
from
model_utils.models
import
TimeStampedModel
from
xmodule_django.models
import
CourseKeyField
from
xmodule_django.models
import
CourseKeyField
from
django.utils.translation
import
ugettext_lazy
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -57,11 +58,19 @@ class CreditCourse(models.Model):
...
@@ -57,11 +58,19 @@ class CreditCourse(models.Model):
class
CreditProvider
(
TimeStampedModel
):
class
CreditProvider
(
TimeStampedModel
):
"""This model represents an institution that can grant credit for a course.
"""This model represents an institution that can grant credit for a course.
Each provider is identified by unique ID (e.g., 'ASU').
Each provider is identified by unique ID (e.g., 'ASU'). CreditProvider also
includes a `url` where the student will be sent when he/she will try to
get credit for course. Eligibility duration will be use to set duration
for which credit eligible message appears on dashboard.
"""
"""
provider_id
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
,
unique
=
True
)
provider_id
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
,
unique
=
True
)
display_name
=
models
.
CharField
(
max_length
=
255
)
display_name
=
models
.
CharField
(
max_length
=
255
)
provider_url
=
models
.
URLField
(
max_length
=
255
,
unique
=
True
)
eligibility_duration
=
models
.
PositiveIntegerField
(
help_text
=
ugettext_lazy
(
u"Number of seconds to show eligibility message"
)
)
active
=
models
.
BooleanField
(
default
=
True
)
class
CreditRequirement
(
TimeStampedModel
):
class
CreditRequirement
(
TimeStampedModel
):
...
...
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