Convert Meta classes to new-style classes

This commit is contained in:
Sarina Canelake
2015-07-10 11:31:45 -04:00
parent b41e70f541
commit 22bbdacee9
19 changed files with 39 additions and 39 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -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 = (

View File

@@ -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')

View File

@@ -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'

View File

@@ -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):

View File

@@ -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'

View File

@@ -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)

View File

@@ -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

View File

@@ -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')

View File

@@ -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'

View File

@@ -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')

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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,

View File

@@ -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",

View File

@@ -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")

View File

@@ -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