I seem to have the same problem, I had to delete the Reserved IP ranges from the zone before I could delete the user. here is the error:
2017-01-05 15:28:52 maasserver.utils.views: [error] 500 Internal Server Error @ /MAAS/accounts/admin2/del/
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3/dist-packages/maasserver/utils/views.py", line 177, in view_atomic_with_post_commit_savepoint
return view_atomic(*args, **kwargs)
File "/usr/lib/python3.5/contextlib.py", line 30, in inner
return func(*args, **kwds)
File "/usr/lib/python3/dist-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/django/views/generic/base.py", line 89, in dispatch
return handler(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/django/views/generic/edit.py", line 301, in post
return self.delete(request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/maasserver/views/settings.py", line 107, in delete
profile.delete()
File "/usr/lib/python3/dist-packages/maasserver/models/userprofile.py", line 77, in delete
self.user.delete()
File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 895, in delete
collector.collect([self])
File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 229, in collect
field.rel.on_delete(self, field, sub_objs, self.using)
File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 28, in PROTECT
sub_objs
django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'User' because they are referenced through a protected foreign key: 'IPRange.user'", [IPRange(subnet_id=2, start_ip='172.0.0.10', end_ip='172.0.0.99', type='dynamic', user_id=3, comment="Added via 'Provide DHCP...' in Web UI.")])
I seem to have the same problem, I had to delete the Reserved IP ranges from the zone before I could delete the user. here is the error:
2017-01-05 15:28:52 maasserver. utils.views: [error] 500 Internal Server Error @ /MAAS/accounts/ admin2/ del/ python3/ dist-packages/ django/ core/handlers/ base.py" , line 132, in get_response callback( request, *callback_args, **callback_kwargs) python3/ dist-packages/ maasserver/ utils/views. py", line 177, in view_atomic_ with_post_ commit_ savepoint python3. 5/contextlib. py", line 30, in inner python3/ dist-packages/ django/ contrib/ auth/decorators .py", line 22, in _wrapped_view python3/ dist-packages/ django/ views/generic/ base.py" , line 71, in view request, *args, **kwargs) python3/ dist-packages/ django/ views/generic/ base.py" , line 89, in dispatch python3/ dist-packages/ django/ views/generic/ edit.py" , line 301, in post request, *args, **kwargs) python3/ dist-packages/ maasserver/ views/settings. py", line 107, in delete delete( ) python3/ dist-packages/ maasserver/ models/ userprofile. py", line 77, in delete user.delete( ) python3/ dist-packages/ django/ db/models/ base.py" , line 895, in delete collect( [self]) python3/ dist-packages/ django/ db/models/ deletion. py", line 229, in collect rel.on_ delete( self, field, sub_objs, self.using) python3/ dist-packages/ django/ db/models/ deletion. py", line 28, in PROTECT db.models. deletion. ProtectedError: ("Cannot delete some instances of model 'User' because they are referenced through a protected foreign key: 'IPRange.user'", [IPRange( subnet_ id=2, start_ip= '172.0. 0.10', end_ip= '172.0. 0.99', type='dynamic', user_id=3, comment="Added via 'Provide DHCP...' in Web UI.")])
Traceback (most recent call last):
File "/usr/lib/
response = wrapped_
File "/usr/lib/
return view_atomic(*args, **kwargs)
File "/usr/lib/
return func(*args, **kwds)
File "/usr/lib/
return view_func(request, *args, **kwargs)
File "/usr/lib/
return self.dispatch(
File "/usr/lib/
return handler(request, *args, **kwargs)
File "/usr/lib/
return self.delete(
File "/usr/lib/
profile.
File "/usr/lib/
self.
File "/usr/lib/
collector.
File "/usr/lib/
field.
File "/usr/lib/
sub_objs
django.