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
8ea3b620
Commit
8ea3b620
authored
May 31, 2016
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added admin for UserAttribute model (#12596)
ECOM-4502
parent
2fd9896c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
13 deletions
+38
-13
common/djangoapps/student/admin.py
+17
-11
common/djangoapps/student/migrations/0005_auto_20160531_1653.py
+19
-0
common/djangoapps/student/models.py
+2
-2
No files found.
common/djangoapps/student/admin.py
View file @
8ea3b620
...
@@ -11,7 +11,7 @@ from xmodule.modulestore.django import modulestore
...
@@ -11,7 +11,7 @@ from xmodule.modulestore.django import modulestore
from
config_models.admin
import
ConfigurationModelAdmin
from
config_models.admin
import
ConfigurationModelAdmin
from
student.models
import
(
from
student.models
import
(
UserProfile
,
UserTestGroup
,
CourseEnrollmentAllowed
,
DashboardConfiguration
,
CourseEnrollment
,
Registration
,
UserProfile
,
UserTestGroup
,
CourseEnrollmentAllowed
,
DashboardConfiguration
,
CourseEnrollment
,
Registration
,
PendingNameChange
,
CourseAccessRole
,
LinkedInAddToProfileConfiguration
PendingNameChange
,
CourseAccessRole
,
LinkedInAddToProfileConfiguration
,
UserAttribute
)
)
from
student.roles
import
REGISTERED_ACCESS_ROLES
from
student.roles
import
REGISTERED_ACCESS_ROLES
...
@@ -103,6 +103,7 @@ class CourseAccessRoleForm(forms.ModelForm):
...
@@ -103,6 +103,7 @@ class CourseAccessRoleForm(forms.ModelForm):
self
.
fields
[
'email'
]
.
initial
=
self
.
instance
.
user
.
email
self
.
fields
[
'email'
]
.
initial
=
self
.
instance
.
user
.
email
@admin.register
(
CourseAccessRole
)
class
CourseAccessRoleAdmin
(
admin
.
ModelAdmin
):
class
CourseAccessRoleAdmin
(
admin
.
ModelAdmin
):
"""Admin panel for the Course Access Role. """
"""Admin panel for the Course Access Role. """
form
=
CourseAccessRoleForm
form
=
CourseAccessRoleForm
...
@@ -127,6 +128,7 @@ class CourseAccessRoleAdmin(admin.ModelAdmin):
...
@@ -127,6 +128,7 @@ class CourseAccessRoleAdmin(admin.ModelAdmin):
super
(
CourseAccessRoleAdmin
,
self
)
.
save_model
(
request
,
obj
,
form
,
change
)
super
(
CourseAccessRoleAdmin
,
self
)
.
save_model
(
request
,
obj
,
form
,
change
)
@admin.register
(
LinkedInAddToProfileConfiguration
)
class
LinkedInAddToProfileConfigurationAdmin
(
admin
.
ModelAdmin
):
class
LinkedInAddToProfileConfigurationAdmin
(
admin
.
ModelAdmin
):
"""Admin interface for the LinkedIn Add to Profile configuration. """
"""Admin interface for the LinkedIn Add to Profile configuration. """
...
@@ -137,6 +139,7 @@ class LinkedInAddToProfileConfigurationAdmin(admin.ModelAdmin):
...
@@ -137,6 +139,7 @@ class LinkedInAddToProfileConfigurationAdmin(admin.ModelAdmin):
exclude
=
(
'dashboard_tracking_code'
,)
exclude
=
(
'dashboard_tracking_code'
,)
@admin.register
(
CourseEnrollment
)
class
CourseEnrollmentAdmin
(
admin
.
ModelAdmin
):
class
CourseEnrollmentAdmin
(
admin
.
ModelAdmin
):
""" Admin interface for the CourseEnrollment model. """
""" Admin interface for the CourseEnrollment model. """
list_display
=
(
'id'
,
'course_id'
,
'mode'
,
'user'
,
'is_active'
,)
list_display
=
(
'id'
,
'course_id'
,
'mode'
,
'user'
,
'is_active'
,)
...
@@ -163,20 +166,23 @@ class UserAdmin(BaseUserAdmin):
...
@@ -163,20 +166,23 @@ class UserAdmin(BaseUserAdmin):
inlines
=
(
UserProfileInline
,)
inlines
=
(
UserProfileInline
,)
admin
.
site
.
register
(
UserTestGroup
)
@admin.register
(
UserAttribute
)
class
UserAttributeAdmin
(
admin
.
ModelAdmin
):
""" Admin interface for the UserAttribute model. """
list_display
=
(
'user'
,
'name'
,
'value'
,)
list_filter
=
(
'name'
,)
raw_id_fields
=
(
'user'
,)
search_fields
=
(
'name'
,
'value'
,
'user__username'
,)
admin
.
site
.
register
(
CourseEnrollmentAllowed
)
class
Meta
(
object
):
model
=
UserAttribute
admin
.
site
.
register
(
Registration
)
admin
.
site
.
register
(
UserTestGroup
)
admin
.
site
.
register
(
CourseEnrollmentAllowed
)
admin
.
site
.
register
(
Registration
)
admin
.
site
.
register
(
PendingNameChange
)
admin
.
site
.
register
(
PendingNameChange
)
admin
.
site
.
register
(
CourseAccessRole
,
CourseAccessRoleAdmin
)
admin
.
site
.
register
(
DashboardConfiguration
,
ConfigurationModelAdmin
)
admin
.
site
.
register
(
DashboardConfiguration
,
ConfigurationModelAdmin
)
admin
.
site
.
register
(
LinkedInAddToProfileConfiguration
,
LinkedInAddToProfileConfigurationAdmin
)
# We must first un-register the User model since it may also be registered by the auth app.
admin
.
site
.
register
(
CourseEnrollment
,
CourseEnrollmentAdmin
)
admin
.
site
.
register
(
User
,
UserAdmin
)
admin
.
site
.
register
(
User
,
UserAdmin
)
common/djangoapps/student/migrations/0005_auto_20160531_1653.py
0 → 100644
View file @
8ea3b620
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'student'
,
'0004_auto_20160531_1422'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'userattribute'
,
name
=
'name'
,
field
=
models
.
CharField
(
help_text
=
'Name of this user attribute.'
,
max_length
=
255
,
db_index
=
True
),
),
]
common/djangoapps/student/models.py
View file @
8ea3b620
...
@@ -2164,10 +2164,10 @@ class UserAttribute(TimeStampedModel):
...
@@ -2164,10 +2164,10 @@ class UserAttribute(TimeStampedModel):
class
Meta
(
object
):
class
Meta
(
object
):
# Ensure that at most one value exists for a given user/name.
# Ensure that at most one value exists for a given user/name.
unique_together
=
((
'user'
,
'name'
)
)
unique_together
=
((
'user'
,
'name'
,),
)
user
=
models
.
ForeignKey
(
User
,
related_name
=
'attributes'
)
user
=
models
.
ForeignKey
(
User
,
related_name
=
'attributes'
)
name
=
models
.
CharField
(
max_length
=
255
,
help_text
=
_
(
"Name of this user attribute."
))
name
=
models
.
CharField
(
max_length
=
255
,
help_text
=
_
(
"Name of this user attribute."
)
,
db_index
=
True
)
value
=
models
.
CharField
(
max_length
=
255
,
help_text
=
_
(
"Value of this user attribute."
))
value
=
models
.
CharField
(
max_length
=
255
,
help_text
=
_
(
"Value of this user attribute."
))
def
__unicode__
(
self
):
def
__unicode__
(
self
):
...
...
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