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
22bbdace
Commit
22bbdace
authored
Jul 10, 2015
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert Meta classes to new-style classes
parent
b41e70f5
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
39 additions
and
39 deletions
+39
-39
common/djangoapps/course_action_state/managers.py
+1
-1
common/djangoapps/course_action_state/models.py
+3
-3
common/djangoapps/course_modes/admin.py
+1
-1
common/djangoapps/course_modes/models.py
+1
-1
common/djangoapps/django_comment_common/models.py
+2
-2
common/djangoapps/embargo/forms.py
+2
-2
common/djangoapps/embargo/models.py
+3
-3
common/djangoapps/external_auth/models.py
+1
-1
common/djangoapps/student/admin.py
+2
-2
common/djangoapps/student/models.py
+6
-6
common/djangoapps/track/backends/django.py
+1
-1
lms/djangoapps/ccx/models.py
+1
-1
lms/djangoapps/certificates/models.py
+2
-2
lms/djangoapps/shoppingcart/models.py
+1
-1
lms/djangoapps/verify_student/models.py
+2
-2
openedx/core/djangoapps/course_groups/models.py
+1
-1
openedx/core/djangoapps/user_api/accounts/serializers.py
+3
-3
openedx/core/djangoapps/user_api/models.py
+3
-3
openedx/core/djangoapps/user_api/serializers.py
+3
-3
No files found.
common/djangoapps/course_action_state/managers.py
View file @
22bbdace
...
...
@@ -10,7 +10,7 @@ class CourseActionStateManager(models.Manager):
An abstract Model Manager class for Course Action State models.
This abstract class expects child classes to define the ACTION (string) field.
"""
class
Meta
:
class
Meta
(
object
)
:
"""Abstract manager class, with subclasses defining the ACTION (string) field."""
abstract
=
True
...
...
common/djangoapps/course_action_state/models.py
View file @
22bbdace
...
...
@@ -21,7 +21,7 @@ class CourseActionState(models.Model):
For example: course copying (reruns), import, export, and validation.
"""
class
Meta
:
class
Meta
(
object
)
:
"""
For performance reasons, we disable "concrete inheritance", by making the Model base class abstract.
With the "abstract base class" inheritance model, tables are only created for derived models, not for
...
...
@@ -77,7 +77,7 @@ class CourseActionUIState(CourseActionState):
"""
An abstract django model that is a sub-class of CourseActionState with additional fields related to UI.
"""
class
Meta
:
class
Meta
(
object
)
:
"""
See comment in CourseActionState on disabling "concrete inheritance".
"""
...
...
@@ -101,7 +101,7 @@ class CourseRerunState(CourseActionUIState):
"""
A concrete django model for maintaining state specifically for the Action Course Reruns.
"""
class
Meta
:
class
Meta
(
object
)
:
"""
Set the (destination) course_key field to be unique for the rerun action
Although multiple reruns can be in progress simultaneously for a particular source course_key,
...
...
common/djangoapps/course_modes/admin.py
View file @
22bbdace
...
...
@@ -16,7 +16,7 @@ from util.date_utils import get_time_display
class
CourseModeForm
(
forms
.
ModelForm
):
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
CourseMode
COURSE_MODE_SLUG_CHOICES
=
(
...
...
common/djangoapps/course_modes/models.py
View file @
22bbdace
...
...
@@ -82,7 +82,7 @@ class CourseMode(models.Model):
# Modes that allow a student to earn credit with a university partner
CREDIT_MODES
=
[
CREDIT_MODE
]
class
Meta
:
class
Meta
(
object
)
:
""" meta attributes of this model """
unique_together
=
(
'course_id'
,
'mode_slug'
,
'currency'
)
...
...
common/djangoapps/django_comment_common/models.py
View file @
22bbdace
...
...
@@ -57,7 +57,7 @@ class Role(models.Model):
users
=
models
.
ManyToManyField
(
User
,
related_name
=
"roles"
)
course_id
=
CourseKeyField
(
max_length
=
255
,
blank
=
True
,
db_index
=
True
)
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
# use existing table that was originally created from django_comment_client app
db_table
=
'django_comment_client_role'
...
...
@@ -99,7 +99,7 @@ class Permission(models.Model):
name
=
models
.
CharField
(
max_length
=
30
,
null
=
False
,
blank
=
False
,
primary_key
=
True
)
roles
=
models
.
ManyToManyField
(
Role
,
related_name
=
"permissions"
)
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
# use existing table that was originally created from django_comment_client app
db_table
=
'django_comment_client_permission'
...
...
common/djangoapps/embargo/forms.py
View file @
22bbdace
...
...
@@ -25,7 +25,7 @@ class RestrictedCourseForm(forms.ModelForm):
error message instead.
"""
class
Meta
:
# pylint: disable=missing-docstring
class
Meta
(
object
)
:
# pylint: disable=missing-docstring
model
=
RestrictedCourse
def
clean_course_key
(
self
):
...
...
@@ -58,7 +58,7 @@ class RestrictedCourseForm(forms.ModelForm):
class
IPFilterForm
(
forms
.
ModelForm
):
"""Form validating entry of IP addresses"""
class
Meta
:
# pylint: disable=missing-docstring
class
Meta
(
object
)
:
# pylint: disable=missing-docstring
model
=
IPFilter
def
_is_valid_ip
(
self
,
address
):
...
...
common/djangoapps/embargo/models.py
View file @
22bbdace
...
...
@@ -379,7 +379,7 @@ class Country(models.Model):
code
=
unicode
(
self
.
country
)
)
class
Meta
:
class
Meta
(
object
)
:
"""Default ordering is ascending by country code """
ordering
=
[
'country'
]
...
...
@@ -522,7 +522,7 @@ class CountryAccessRule(models.Model):
cache
.
delete
(
cache_key
)
log
.
info
(
"Invalidated country access list for course
%
s"
,
course_key
)
class
Meta
:
class
Meta
(
object
)
:
"""a course can be added with either black or white list. """
unique_together
=
(
# This restriction ensures that a country is on
...
...
@@ -646,7 +646,7 @@ class CourseAccessRuleHistory(models.Model):
else
:
CourseAccessRuleHistory
.
save_snapshot
(
restricted_course
)
class
Meta
:
# pylint: disable=missing-docstring,old-style-class
class
Meta
(
object
):
# pylint: disable=missing-docstring
get_latest_by
=
'timestamp'
...
...
common/djangoapps/external_auth/models.py
View file @
22bbdace
...
...
@@ -14,7 +14,7 @@ from django.contrib.auth.models import User
class
ExternalAuthMap
(
models
.
Model
):
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
unique_together
=
((
'external_id'
,
'external_domain'
),
)
external_id
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
)
external_domain
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
)
...
...
common/djangoapps/student/admin.py
View file @
22bbdace
...
...
@@ -20,7 +20,7 @@ from opaque_keys import InvalidKeyError
class
CourseAccessRoleForm
(
forms
.
ModelForm
):
"""Form for adding new Course Access Roles view the Django Admin Panel."""
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
CourseAccessRole
email
=
forms
.
EmailField
(
required
=
True
)
...
...
@@ -123,7 +123,7 @@ class CourseAccessRoleAdmin(admin.ModelAdmin):
class
LinkedInAddToProfileConfigurationAdmin
(
admin
.
ModelAdmin
):
"""Admin interface for the LinkedIn Add to Profile configuration. """
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
LinkedInAddToProfileConfiguration
# Exclude deprecated fields
...
...
common/djangoapps/student/models.py
View file @
22bbdace
...
...
@@ -216,7 +216,7 @@ class UserProfile(models.Model):
MITx fall prototype.
"""
class
Meta
:
# pylint: disable=missing-docstring
class
Meta
(
object
)
:
# pylint: disable=missing-docstring
db_table
=
"auth_userprofile"
# CRITICAL TODO/SECURITY
...
...
@@ -436,7 +436,7 @@ class Registration(models.Model):
registration profile is created when the user creates an
account, but that account is inactive. Once the user clicks
on the activation key, it becomes active. '''
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
db_table
=
"auth_registration"
user
=
models
.
ForeignKey
(
User
,
unique
=
True
)
...
...
@@ -846,7 +846,7 @@ class CourseEnrollment(models.Model):
objects
=
CourseEnrollmentManager
()
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
unique_together
=
((
'user'
,
'course_id'
),)
ordering
=
(
'user'
,
'course_id'
)
...
...
@@ -1407,7 +1407,7 @@ class CourseEnrollmentAllowed(models.Model):
created
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
,
db_index
=
True
)
class
Meta
:
# pylint: disable=missing-docstring
class
Meta
(
object
)
:
# pylint: disable=missing-docstring
unique_together
=
((
'email'
,
'course_id'
),)
def
__unicode__
(
self
):
...
...
@@ -1444,7 +1444,7 @@ class CourseAccessRole(models.Model):
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
,
blank
=
True
)
role
=
models
.
CharField
(
max_length
=
64
,
db_index
=
True
)
class
Meta
:
# pylint: disable=missing-docstring
class
Meta
(
object
)
:
# pylint: disable=missing-docstring
unique_together
=
(
'user'
,
'org'
,
'course_id'
,
'role'
)
@property
...
...
@@ -1835,7 +1835,7 @@ class LanguageProficiency(models.Model):
/edx-platform/openedx/core/djangoapps/user_api/accounts/views.py or its associated api method
(update_account_settings) so that the events are emitted.
"""
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
unique_together
=
((
'code'
,
'user_profile'
),)
user_profile
=
models
.
ForeignKey
(
UserProfile
,
db_index
=
True
,
related_name
=
'language_proficiencies'
)
...
...
common/djangoapps/track/backends/django.py
View file @
22bbdace
...
...
@@ -46,7 +46,7 @@ class TrackingLog(models.Model):
time
=
models
.
DateTimeField
(
'event time'
)
host
=
models
.
CharField
(
max_length
=
64
,
blank
=
True
)
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
app_label
=
'track'
db_table
=
'track_trackinglog'
...
...
lms/djangoapps/ccx/models.py
View file @
22bbdace
...
...
@@ -150,7 +150,7 @@ class CcxFieldOverride(models.Model):
location
=
LocationKeyField
(
max_length
=
255
,
db_index
=
True
)
field
=
models
.
CharField
(
max_length
=
255
)
class
Meta
:
# pylint: disable=missing-docstring,old-style-class
class
Meta
(
object
):
# pylint: disable=missing-docstring
unique_together
=
((
'ccx'
,
'location'
,
'field'
),)
value
=
models
.
TextField
(
default
=
'null'
)
lms/djangoapps/certificates/models.py
View file @
22bbdace
...
...
@@ -241,7 +241,7 @@ class ExampleCertificateSet(TimeStampedModel):
"""
course_key
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
)
class
Meta
:
# pylint: disable=missing-docstring, old-style-class
class
Meta
(
object
):
# pylint: disable=missing-docstring
get_latest_by
=
'created'
@classmethod
...
...
@@ -498,7 +498,7 @@ class CertificateGenerationCourseSetting(TimeStampedModel):
course_key
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
)
enabled
=
models
.
BooleanField
(
default
=
False
)
class
Meta
:
# pylint: disable=missing-docstring, old-style-class
class
Meta
(
object
):
# pylint: disable=missing-docstring
get_latest_by
=
'created'
@classmethod
...
...
lms/djangoapps/shoppingcart/models.py
View file @
22bbdace
...
...
@@ -1163,7 +1163,7 @@ class InvoiceHistory(models.Model):
elif
hasattr
(
instance
,
'invoice'
):
InvoiceHistory
.
save_invoice_snapshot
(
instance
.
invoice
)
class
Meta
:
# pylint: disable=missing-docstring,old-style-class
class
Meta
(
object
):
# pylint: disable=missing-docstring
get_latest_by
=
"timestamp"
...
...
lms/djangoapps/verify_student/models.py
View file @
22bbdace
...
...
@@ -895,7 +895,7 @@ class VerificationCheckpoint(models.Model):
checkpoint_location
=
models
.
CharField
(
max_length
=
255
)
photo_verification
=
models
.
ManyToManyField
(
SoftwareSecurePhotoVerification
)
class
Meta
:
# pylint: disable=missing-docstring, old-style-class
class
Meta
(
object
):
# pylint: disable=missing-docstring
unique_together
=
(
'course_id'
,
'checkpoint_location'
)
def
__unicode__
(
self
):
...
...
@@ -1089,7 +1089,7 @@ class SkippedReverification(models.Model):
checkpoint
=
models
.
ForeignKey
(
VerificationCheckpoint
,
related_name
=
"skipped_checkpoint"
)
created_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
class
Meta
:
# pylint: disable=missing-docstring, old-style-class
class
Meta
(
object
):
# pylint: disable=missing-docstring
unique_together
=
((
'user'
,
'course_id'
),)
@classmethod
...
...
openedx/core/djangoapps/course_groups/models.py
View file @
22bbdace
...
...
@@ -18,7 +18,7 @@ class CourseUserGroup(models.Model):
which may be treated specially. For example, a user can be in at most one cohort per
course, and cohorts are used to split up the forums by group.
"""
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
unique_together
=
((
'name'
,
'course_id'
),
)
name
=
models
.
CharField
(
max_length
=
255
,
...
...
openedx/core/djangoapps/user_api/accounts/serializers.py
View file @
22bbdace
...
...
@@ -15,7 +15,7 @@ class LanguageProficiencySerializer(serializers.ModelSerializer):
Class that serializes the LanguageProficiency model for account
information.
"""
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
LanguageProficiency
fields
=
(
"code"
,)
...
...
@@ -36,7 +36,7 @@ class AccountUserSerializer(serializers.HyperlinkedModelSerializer, ReadOnlyFiel
"""
Class that serializes the portion of User model needed for account information.
"""
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
User
fields
=
(
"username"
,
"email"
,
"date_joined"
,
"is_active"
)
read_only_fields
=
(
"username"
,
"email"
,
"date_joined"
,
"is_active"
)
...
...
@@ -51,7 +51,7 @@ class AccountLegacyProfileSerializer(serializers.HyperlinkedModelSerializer, Rea
requires_parental_consent
=
serializers
.
SerializerMethodField
(
"get_requires_parental_consent"
)
language_proficiencies
=
LanguageProficiencySerializer
(
many
=
True
,
allow_add_remove
=
True
,
required
=
False
)
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
UserProfile
fields
=
(
"name"
,
"gender"
,
"goals"
,
"year_of_birth"
,
"level_of_education"
,
"country"
,
...
...
openedx/core/djangoapps/user_api/models.py
View file @
22bbdace
...
...
@@ -24,7 +24,7 @@ class UserPreference(models.Model):
key
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
,
validators
=
[
RegexValidator
(
KEY_REGEX
)])
value
=
models
.
TextField
()
class
Meta
:
# pylint: disable=missing-docstring
class
Meta
(
object
)
:
# pylint: disable=missing-docstring
unique_together
=
(
"user"
,
"key"
)
@classmethod
...
...
@@ -93,7 +93,7 @@ class UserCourseTag(models.Model):
course_id
=
CourseKeyField
(
max_length
=
255
,
db_index
=
True
)
value
=
models
.
TextField
()
class
Meta
:
# pylint: disable=missing-docstring
class
Meta
(
object
)
:
# pylint: disable=missing-docstring
unique_together
=
(
"user"
,
"course_id"
,
"key"
)
...
...
@@ -108,6 +108,6 @@ class UserOrgTag(TimeStampedModel):
org
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
)
value
=
models
.
TextField
()
class
Meta
:
class
Meta
(
object
)
:
""" Meta class for defining unique constraints. """
unique_together
=
(
"user"
,
"org"
,
"key"
)
openedx/core/djangoapps/user_api/serializers.py
View file @
22bbdace
...
...
@@ -16,7 +16,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
def
get_preferences
(
self
,
user
):
return
dict
([(
pref
.
key
,
pref
.
value
)
for
pref
in
user
.
preferences
.
all
()])
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
User
# This list is the minimal set required by the notification service
fields
=
(
"id"
,
"url"
,
"email"
,
"name"
,
"username"
,
"preferences"
)
...
...
@@ -26,7 +26,7 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
class
UserPreferenceSerializer
(
serializers
.
HyperlinkedModelSerializer
):
user
=
UserSerializer
()
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
UserPreference
depth
=
1
...
...
@@ -36,7 +36,7 @@ class RawUserPreferenceSerializer(serializers.ModelSerializer):
"""
user
=
serializers
.
PrimaryKeyRelatedField
()
class
Meta
:
class
Meta
(
object
):
# pylint: disable=missing-docstring
model
=
UserPreference
depth
=
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