Skip to content

Commit

Permalink
cleanuped code
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-gray-tangent committed Jul 3, 2024
1 parent c936a68 commit 23fd5f4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ def register(request):
if request.method == "POST":
form = CustomUserCreationForm(request.POST)
if form.is_valid():
user = form.save(
commit=False
) # Save the user object without committing to the database
user.is_staff = True # Set the user as a staff member
user.save() # Save the user object to the database
login(request, user) # Log the user in
user = form.save(commit=False)
user.is_staff = True
user.save()
login(request, user)
return redirect("home")
else:
form = CustomUserCreationForm()
Expand Down

0 comments on commit 23fd5f4

Please sign in to comment.