add code of user for show in angular
This commit is contained in:
parent
c5234e0fd4
commit
5e8c4a3231
|
@ -59,6 +59,13 @@ class User(Thing):
|
|||
"""The individual associated for this database, or None."""
|
||||
return next(iter(self.individuals), None)
|
||||
|
||||
@property
|
||||
def code(self):
|
||||
"""Code of phantoms accounts"""
|
||||
if not self.phantom:
|
||||
return
|
||||
return self.email.split('@')[0].split('_')[1]
|
||||
|
||||
|
||||
class UserInventory(db.Model):
|
||||
"""Relationship between users and their inventories."""
|
||||
|
|
|
@ -23,6 +23,7 @@ class User(Thing):
|
|||
description='Use this token in an Authorization header to access the app.'
|
||||
'The token can change overtime.')
|
||||
inventories = NestedOn(Inventory, many=True, dump_only=True)
|
||||
code = String(dump_only=True, description='Code of inactive accounts')
|
||||
|
||||
def __init__(self,
|
||||
only=None,
|
||||
|
|
Reference in New Issue