Revision 5ce3ce4f snf-astakos-app/astakos/im/management/commands/invitation_show.py
b/snf-astakos-app/astakos/im/management/commands/invitation_show.py | ||
---|---|---|
41 | 41 |
class Command(BaseCommand): |
42 | 42 |
args = "<invitation ID>" |
43 | 43 |
help = "Show invitation info" |
44 |
|
|
44 |
|
|
45 | 45 |
def handle(self, *args, **options): |
46 | 46 |
if len(args) != 1: |
47 | 47 |
raise CommandError("Please provide an invitation id") |
48 |
|
|
48 |
|
|
49 | 49 |
try: |
50 | 50 |
invitation = Invitation.objects.get(id=int(args[0])) |
51 | 51 |
except Invitation.DoesNotExist: |
52 | 52 |
raise CommandError("Unknown invitation id '%s'" % (args[0],)) |
53 |
|
|
53 |
|
|
54 | 54 |
kv = { |
55 | 55 |
'id': invitation.id, |
56 | 56 |
'real name': invitation.realname, |
... | ... | |
62 | 62 |
'inviter real name': invitation.inviter.realname, |
63 | 63 |
'invitater email': invitation.inviter.email, |
64 | 64 |
} |
65 |
|
|
65 |
|
|
66 | 66 |
for key, val in sorted(kv.items()): |
67 | 67 |
line = '%s: %s\n' % (key.rjust(18), val) |
68 | 68 |
self.stdout.write(line.encode('utf8')) |
Also available in: Unified diff