Revision 094c0768

b/snf-astakos-app/astakos/im/management/commands/user-list.py
68 68
        elif options['pending_send_mail']:
69 69
            users = users.filter(is_active=False, activation_sent=None)
70 70

  
71
        labels = ('id', 'email', 'real name', 'active', 'admin', 'providers')
72
        columns = (3, 24, 24, 6, 5, 12, 24)
71
        labels = ('id', 'email', 'real name', 'active', 'admin', 'uuid', 'providers')
72
        columns = (3, 24, 24, 6, 5, 12, 36, 24)
73 73

  
74 74
        if not options['csv']:
75 75
            line = ' '.join(l.rjust(w) for l, w in zip(labels, columns))
......
81 81
            id = str(user.id)
82 82
            active = format_bool(user.is_active)
83 83
            admin = format_bool(user.is_superuser)
84
            uuid = user.uuid or ''
84 85
            fields = (
85 86
                id, user.email, user.realname, active, admin, \
86
                        user.auth_providers_display
87
                        uuid, user.auth_providers_display
87 88
            )
88 89

  
89 90
            if options['csv']:
b/snf-astakos-app/astakos/im/management/commands/user-show.py
38 38

  
39 39
from ._common import format
40 40

  
41
import uuid
41 42

  
42 43
class Command(BaseCommand):
43 44
    args = "<user ID or email>"
......
47 48
        if len(args) != 1:
48 49
            raise CommandError("Please provide a user ID or email")
49 50

  
50
        email_or_id = args[0]
51
        if email_or_id.isdigit():
52
            users = AstakosUser.objects.filter(id=int(email_or_id))
51
        identifier = args[0]
52
        if identifier.isdigit():
53
            users = AstakosUser.objects.filter(id=int(identifier))
53 54
        else:
54
            users = AstakosUser.objects.filter(email__iexact=email_or_id)
55
            try:
56
                uuid.UUID(identifier)
57
            except:
58
                users = AstakosUser.objects.filter(email__iexact=identifier)
59
            else:
60
                users = AstakosUser.objects.filter(uuid=identifier)
55 61
        if users.count() == 0:
56
            field = 'id' if email_or_id.isdigit() else 'email'
57
            msg = "Unknown user with %s '%s'" % (field, email_or_id)
62
            field = 'id' if identifier.isdigit() else 'email'
63
            msg = "Unknown user with %s '%s'" % (field, identifier)
58 64
            raise CommandError(msg)
59 65

  
60 66
        for user in users:

Also available in: Unified diff