1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 07:35:22 +00:00

Replaced __unicode__ with __str__ for models

This commit is contained in:
Real-Gecko 2020-06-15 12:57:17 +06:00
parent cfd739778c
commit 9a75ceb0e5
5 changed files with 14 additions and 12 deletions

View file

@ -1,3 +1,4 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.core.validators import MinValueValidator
from django.db import models
@ -13,7 +14,7 @@ class UserInstance(models.Model):
is_delete = models.BooleanField(default=False)
is_vnc = models.BooleanField(default=False)
def __unicode__(self):
def __str__(self):
return self.instance.name
@ -22,7 +23,7 @@ class UserSSHKey(models.Model):
keyname = models.CharField(_('key name'), max_length=25)
keypublic = models.CharField(_('public key'), max_length=500)
def __unicode__(self):
def __str__(self):
return self.keyname
@ -76,7 +77,7 @@ class UserAttributes(models.Model):
UserAttributes.create_missing_userattributes(user)
UserAttributes.add_default_instances(user)
def __unicode__(self):
def __str__(self):
return self.user.username

View file

@ -1,6 +1,7 @@
from django.db.models import Model, CharField, IntegerField
from django.utils.translation import ugettext_lazy as _
class Compute(Model):
name = CharField(_('name'), max_length=64, unique=True)
hostname = CharField(_('hostname'), max_length=64)
@ -9,5 +10,5 @@ class Compute(Model):
details = CharField(_('details'), max_length=64, null=True, blank=True)
type = IntegerField()
def __unicode__(self):
def __str__(self):
return self.hostname

View file

@ -1,11 +1,12 @@
from django.db.models import Model, CharField, IntegerField
from django.utils.translation import ugettext_lazy as _
class Flavor(Model):
label = CharField(_('label'), max_length=12)
memory = IntegerField(_('memory'))
vcpu = IntegerField(_('vcpu'))
disk = IntegerField(_('disk'))
def __unicode__(self):
def __str__(self):
return self.name

View file

@ -1,5 +1,4 @@
from django.db.models import (CASCADE, BooleanField, CharField, DateField,
ForeignKey, Model)
from django.db.models import (CASCADE, BooleanField, CharField, DateField, ForeignKey, Model)
from django.utils.translation import ugettext_lazy as _
from computes.models import Compute
@ -12,17 +11,16 @@ class Instance(Model):
is_template = BooleanField(_('is template'), default=False)
created = DateField(_('created'), auto_now_add=True)
def __unicode__(self):
def __str__(self):
return self.name
class PermissionSet(Model):
"""
Dummy model for holding set of permissions we need to be automatically added by Django
"""
class Meta:
default_permissions = ()
permissions = (
('clone_instances', _('Can clone instances')),
)
permissions = (('clone_instances', _('Can clone instances')), )
managed = False

View file

@ -1,11 +1,12 @@
from django.db.models import Model, CharField, DateTimeField
from django.utils.translation import ugettext_lazy as _
class Logs(Model):
user = CharField(_('user'), max_length=50)
instance = CharField(_('instance'), max_length=50)
message = CharField(_('message'), max_length=255)
date = DateTimeField(_('date'), auto_now=True)
def __unicode__(self):
def __str__(self):
return self.instance