I've been trying to override the default __unicode__()
method for the django.contrib.auth.models User model but I can't get it to work.
I tried it like this:
from django.db import models
from django.contrib.auth.models import User
class User(models.Model):
def __unicode__(self):
return "pie"
and
from django.db import models
from django.contrib.auth.models import User
class User(User):
def __unicode__(self):
return "pie"
but it's not working, I know it's wrong like that but I have no idea how to do it properly.
All I want it to do is to say "pie" instead of the user name inside the admin panel.
edit:
Managed to do it like this:
class MyUser(User):
class Meta:
proxy = True
def __unicode__(self):
if self.get_full_name() == '':
return "pie"
else:
return self.get_full_name()
I used the MyUser class when making ForeignKey references, instead of User.