mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-05-30 17:09:37 +00:00
Get UserAttributes object using get_or_create
This is done to automatically create the UserAttributes object in case LDAP User Backend didn't create it.
This commit is contained in:
@@ -117,7 +117,7 @@ def user_create(request):
|
||||
@superuser_only
|
||||
def user_update(request, pk):
|
||||
user = get_object_or_404(User, pk=pk)
|
||||
attributes = UserAttributes.objects.get(user=user)
|
||||
attributes, attributes_created = UserAttributes.objects.get_or_create(user=user)
|
||||
user_form = forms.UserForm(request.POST or None, instance=user)
|
||||
attributes_form = forms.UserAttributesForm(
|
||||
request.POST or None, instance=attributes
|
||||
|
||||
Reference in New Issue
Block a user