Index: /branches/amp_3_7/src/webui/webui/htdocs/new/src/hive/model/manager.py
===================================================================
--- /branches/amp_3_7/src/webui/webui/htdocs/new/src/hive/model/manager.py	(revision 2445)
+++ /branches/amp_3_7/src/webui/webui/htdocs/new/src/hive/model/manager.py	(working copy)
@@ -255,6 +255,8 @@
         # or else, just update the specified fields
 
         # To support update pk field
+        non_editable_fields = ['username', 'auth', 'user_type', 'role_id', 'role_name', 'root', 'passwords',
+                               'phone_num', 'email']
         old_instance = None
         if field_list:
             for each_field in field_list:
@@ -286,44 +288,49 @@
                     continue
                 else:
                     assert 0, 'Field %s is passed to update but has DelayedQuery value' % field_name
-                    
+
             # find the _get_<field_name> function
-            if hasattr(self, '_update_'+field_name):
-                try:
-                    update_function = getattr(self, '_update_'+field_name)
-                    if 'old_values' in inspect.getargspec(update_function).args:
-                        update_function(model_instance, old_values)
-                    else:
-                        update_function(model_instance)
-                except ModelQueryException as e:
-                    oper_log('error', model_instance._meta.path[-2], 'Failed to update the field of %s <%s>.' % (field_name, model_instance.repr_by_pk(model_instance.pk_dict())))
-                    exception.merge(e)
-                done_list.append(field_name)
-                # Only mark the field as expired when it is handled (updated) above
-                mark_expire_field(model_instance, field_name)
-            else: # find from the _custom_updates dict
-                custom_update_func = self._custom_updates.get(field_name, None)
-                if custom_update_func:
-                    # this is an unbound method, call with self
+            if field_name not in non_editable_fields:
+                if hasattr(self, '_update_' + field_name):
                     try:
-                        if 'old_values' in inspect.getargspec(custom_update_func).args:
-                            custom_update_func(self, model_instance, old_values)
+                        update_function = getattr(self, '_update_' + field_name)
+                        if 'old_values' in inspect.getargspec(update_function).args:
+                            update_function(model_instance, old_values)
                         else:
-                            custom_update_func(self, model_instance)
+                            update_function(model_instance)
                     except ModelQueryException as e:
-                        oper_log('error', model_instance._meta.path[-2], 'Failed to update the field of %s <%s>.' % (field_name, model_instance.repr_by_pk(model_instance.pk_dict())))
+                        oper_log('error', model_instance._meta.path[-2], 'Failed to update the field of %s <%s>.' % (
+                            field_name, model_instance.repr_by_pk(model_instance.pk_dict())))
                         exception.merge(e)
-                    done_list.extend(self._custom_updates_reverse[custom_update_func])
-                    for each_done_field in self._custom_updates_reverse[custom_update_func]:
-                        mark_expire_field(model_instance, each_done_field)
-                else:
-                    # come to here means this field can not be updated
-                    # append the error
-                    oper_log('error', model_instance._meta.path[-2], 'Failed to update the field of %s <%s>.' % (field_name, model_instance.repr_by_pk(model_instance.pk_dict())))
-                    if not update_all:
-                        error_list.append(field_name)
-                    continue # go to next field so as not to mark expiration
-                        
+                    done_list.append(field_name)
+                    # Only mark the field as expired when it is handled (updated) above
+                    mark_expire_field(model_instance, field_name)
+                else:  # find from the _custom_updates dict
+                    custom_update_func = self._custom_updates.get(field_name, None)
+                    if custom_update_func:
+                        # this is an unbound method, call with self
+                        try:
+                            if 'old_values' in inspect.getargspec(custom_update_func).args:
+                                custom_update_func(self, model_instance, old_values)
+                            else:
+                                custom_update_func(self, model_instance)
+                        except ModelQueryException as e:
+                            oper_log('error', model_instance._meta.path[-2],
+                                     'Failed to update the field of %s <%s>.' % (
+                                         field_name, model_instance.repr_by_pk(model_instance.pk_dict())))
+                            exception.merge(e)
+                        done_list.extend(self._custom_updates_reverse[custom_update_func])
+                        for each_done_field in self._custom_updates_reverse[custom_update_func]:
+                            mark_expire_field(model_instance, each_done_field)
+                    else:
+                        # come to here means this field can not be updated
+                        # append the error
+                        oper_log('error', model_instance._meta.path[-2], 'Failed to update the field of %s <%s>.' % (
+                            field_name, model_instance.repr_by_pk(model_instance.pk_dict())))
+                        if not update_all:
+                            error_list.append(field_name)
+                        continue  # go to next field so as not to mark expiration
+
         # still some un-updated fields, try the general update function _update or _insert_or_update
         if len(done_list) < len(field_list):
             try:
