Changeset 7dc1f81 in OpenWorkouts-current for ow/models/user.py


Ignore:
Timestamp:
Feb 17, 2019, 6:25:52 PM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current, feature/docs, master
Children:
bfbf428
Parents:
23b5569
Message:

Better str and repr representation for the User model.

This is basically useful for developers using pshell for debugging
purposes, as adding the email address to the repr makes easier
(faster) to spot who a given user object is.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/models/user.py

    r23b5569 r7dc1f81  
    4242
    4343    def __str__(self):
    44         return u'User: %s (%s)' % (self.email, self.uid)
     44        return u'User: %s (%s)' % (self.uid, self.email)
     45
     46    def __repr__(self):
     47        return u'<%s.%s: %s (%s)>' % (
     48            self.__class__.__module__,
     49            self.__class__.__name__,
     50            self.uid, self.email
     51        )
    4552
    4653    @property
Note: See TracChangeset for help on using the changeset viewer.