Merge pull request #174 from gabrielhurley/tenant_name_fix

Fixes LP bug 875231 -- use tenant name instead of id for dropdown.
This commit is contained in:
Devin Carlen 2011-10-27 15:25:49 -07:00
commit 0e08f4f92b

View File

@ -47,7 +47,7 @@ class UserForm(forms.Form):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
tenant_list = kwargs.pop('tenant_list', None) tenant_list = kwargs.pop('tenant_list', None)
super(UserForm, self).__init__(*args, **kwargs) super(UserForm, self).__init__(*args, **kwargs)
self.fields['tenant_id'].choices = [[tenant.id, tenant.id] self.fields['tenant_id'].choices = [[tenant.id, tenant.name]
for tenant in tenant_list] for tenant in tenant_list]
name = forms.CharField(label=_("Name")) name = forms.CharField(label=_("Name"))
@ -62,7 +62,7 @@ class UserUpdateForm(forms.Form):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
tenant_list = kwargs.pop('tenant_list', None) tenant_list = kwargs.pop('tenant_list', None)
super(UserUpdateForm, self).__init__(*args, **kwargs) super(UserUpdateForm, self).__init__(*args, **kwargs)
self.fields['tenant_id'].choices = [[tenant.id, tenant.id] self.fields['tenant_id'].choices = [[tenant.id, tenant.name]
for tenant in tenant_list] for tenant in tenant_list]
id = forms.CharField(label=_("ID"), id = forms.CharField(label=_("ID"),