1
0
Fork 0

users/models: Replace __unicode__ by __str__ (W5102)

The special method __unicode__ is python2-only,
in python3 it's merged with __str__. In order to be py23-compatible
the python_2_unicode_compatible decorator is used, see
https://docs.djangoproject.com/en/1.11/topics/python3/#str-and-unicode-methods

Equivalent commit in db: librespacefoundation/satnogs/satnogs-db@9a0ef30e
Equivalent commit for base model: d20943ce

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
merge-requests/864/head
Fabian P. Schmidt 2019-12-31 22:46:42 +01:00 committed by Alfredos-Panagiotis Damkalis
parent aa0b657de1
commit 7443d76a2f
1 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@ from django.contrib.auth.models import AbstractUser
from django.core.validators import MaxLengthValidator
from django.db import models
from django.db.models.signals import post_save
from django.utils.encoding import python_2_unicode_compatible
from rest_framework.authtoken.models import Token
@ -16,6 +17,7 @@ def gen_token(sender, instance, created, **kwargs): # pylint: disable=W0613
Token.objects.create(user=instance)
@python_2_unicode_compatible
class User(AbstractUser):
"""Model for SatNOGS users."""
@ -28,7 +30,7 @@ class User(AbstractUser):
return self.get_full_name()
return self.username
def __unicode__(self):
def __str__(self):
return self.username