I created a custom user class in django 1.5, which is the successor to the AbBabBaseUser. In the classroom there is a field 'email' which is unique ID, however, I am using an externally developed app which is the user class for but I continue to receive the I think what this database has to do with lookups is another way to take advantage of it? Perhaps the method to specify the field name alias You can do this by creating custom queries: django.db.models.query import from: username for
get () Is hoping to use in I would not want to add additional unnecessary fields to my user class, and when I ask for that username, I would like to return the email address to this app I have tried to use a property in my user category:
@property def Username (auto): return self.email
field error ... in the keyword field 'User name 'Can not be solved
find () invokes
QuerySet.filter () , there is no effect on
QuerySet on creating the property, it only works when a
user example attribute
Username user accesses .
QuerySet class MyUserManager (baseUserManager): def __getattr__ (auto, attr, * Argus): Try Return Geetter (Auto______, Entry, * AGR), excluding Attribute Error: Return Gateter (auto.get_query_set (), atri, * AGR) df mill_query_set (self): Returns MySQL (self) .model ) MyQuerySet: def filter (self, * args, ** kwargs): If the 'username' kwargs in: kwargs.update ({'email': k Wargs.pop ('username')}) Return super (MyQuerySet, self). Filler (* Args, ** quarges) Class MyUser (AbbattBusUser): Email = ... objects = My User Manager () USERNAME_FIELD = 'email'
No comments:
Post a Comment