Add tests for accounts, and fix allowing user to delete friend code with active trade offers and in-game-name not being set on signup

This commit is contained in:
badblocks 2025-03-26 14:25:09 -07:00
parent 65ca344582
commit 23d334c596
6 changed files with 658 additions and 10 deletions

View file

@ -74,12 +74,13 @@ class CustomUserCreationForm(SignupForm):
def save(self, request):
# First, complete the normal signup process.
user = super(CustomUserCreationForm, self).save(request)
# Create the associated FriendCode record.
friend_code_pk = FriendCode.objects.create(
# Create the associated FriendCode record, now including in_game_name.
friend_code_instance = FriendCode.objects.create(
friend_code=self.cleaned_data["friend_code"],
in_game_name=self.cleaned_data["in_game_name"],
user=user
)
user.default_friend_code = friend_code_pk
user.default_friend_code = friend_code_instance
user.save()
return user