Resolve default ordering warnings from tests

This commit is contained in:
AlanCoding
2019-05-02 18:00:18 -04:00
parent f174902bb2
commit f4c18843a3
13 changed files with 82 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ class AdHocCommand(UnifiedJob, JobNotificationMixin):
class Meta(object):
app_label = 'main'
ordering = ('id',)
diff_mode = models.BooleanField(
default=False,

View File

@@ -1312,6 +1312,7 @@ class CredentialInputSource(PrimordialModel):
class Meta:
app_label = 'main'
unique_together = (('target_credential', 'input_field_name'),)
ordering = ('target_credential', 'source_credential', 'input_field_name',)
target_credential = models.ForeignKey(
'Credential',

View File

@@ -98,6 +98,7 @@ class Instance(HasPolicyEditsMixin, BaseModel):
class Meta:
app_label = 'main'
ordering = ("hostname",)
POLICY_FIELDS = frozenset(('managed_by_policy', 'hostname', 'capacity_adjustment'))

View File

@@ -1451,6 +1451,7 @@ class InventorySource(UnifiedJobTemplate, InventorySourceOptions, CustomVirtualE
class Meta:
app_label = 'main'
ordering = ('inventory', 'name')
inventory = models.ForeignKey(
'Inventory',
@@ -1680,6 +1681,7 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions, JobNotificationMixin,
class Meta:
app_label = 'main'
ordering = ('inventory', 'name')
inventory = models.ForeignKey(
'Inventory',

View File

@@ -50,6 +50,7 @@ class NotificationTemplate(CommonModelNameNotUnique):
class Meta:
app_label = 'main'
unique_together = ('organization', 'name')
ordering = ("name",)
organization = models.ForeignKey(
'Organization',

View File

@@ -28,6 +28,7 @@ class OAuth2Application(AbstractApplication):
app_label = 'main'
verbose_name = _('application')
unique_together = (("name", "organization"),)
ordering = ('organization', 'name')
CLIENT_CONFIDENTIAL = "confidential"
CLIENT_PUBLIC = "public"
@@ -89,6 +90,7 @@ class OAuth2AccessToken(AbstractAccessToken):
class Meta:
app_label = 'main'
verbose_name = _('access token')
ordering = ('id',)
user = models.ForeignKey(
settings.AUTH_USER_MODEL,

View File

@@ -138,6 +138,7 @@ class Role(models.Model):
index_together = [
("content_type", "object_id")
]
ordering = ("content_type", "object_id")
role_field = models.TextField(null=False)
singleton_name = models.TextField(null=True, default=None, db_index=True, unique=True)

View File

@@ -98,6 +98,7 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique, Notificatio
class Meta:
app_label = 'main'
ordering = ('name',)
# unique_together here is intentionally commented out. Please make sure sub-classes of this model
# contain at least this uniqueness restriction: SOFT_UNIQUE_TOGETHER = [('polymorphic_ctype', 'name')]
#unique_together = [('polymorphic_ctype', 'name')]
@@ -556,6 +557,7 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
class Meta:
app_label = 'main'
ordering = ('id',)
old_pk = models.PositiveIntegerField(
null=True,