diff --git a/tailbone/views/users.py b/tailbone/views/users.py index 86167de5..07d1c254 100644 --- a/tailbone/views/users.py +++ b/tailbone/views/users.py @@ -142,20 +142,21 @@ class UsersView(PrincipalMasterView): # person f.set_renderer('person', self.render_person) if self.creating or self.editing: - f.replace('person', 'person_uuid') - f.set_node('person_uuid', colander.String(), missing=colander.null) - person_display = "" - if self.request.method == 'POST': - if self.request.POST.get('person_uuid'): - person = self.Session.query(model.Person).get(self.request.POST['person_uuid']) - if person: - person_display = six.text_type(person) - elif self.editing: - person_display = six.text_type(user.person or '') - people_url = self.request.route_url('people.autocomplete') - f.set_widget('person_uuid', forms.widgets.JQueryAutocompleteWidget( - field_display=person_display, service_url=people_url)) - f.set_label('person_uuid', "Person") + if 'person' in f.fields: + f.replace('person', 'person_uuid') + f.set_node('person_uuid', colander.String(), missing=colander.null) + person_display = "" + if self.request.method == 'POST': + if self.request.POST.get('person_uuid'): + person = self.Session.query(model.Person).get(self.request.POST['person_uuid']) + if person: + person_display = six.text_type(person) + elif self.editing: + person_display = six.text_type(user.person or '') + people_url = self.request.route_url('people.autocomplete') + f.set_widget('person_uuid', forms.widgets.JQueryAutocompleteWidget( + field_display=person_display, service_url=people_url)) + f.set_label('person_uuid', "Person") # password f.set_widget('password', dfwidget.CheckedPasswordWidget())