Skip to content

Commit ba2a19c

Browse files
committed
Fix an issue with repeatability of the sample_data command
The sample_data management command fails when run twice. The script should be idempotent in nature
1 parent 524f2ee commit ba2a19c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

junction/conferences/management/commands/sample_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def create_user(self, counter=None, username=None, email=None, **kwargs):
214214
"is_superuser": kwargs.get('is_superuser', False),
215215
"is_staff": kwargs.get('is_staff', kwargs.get('is_superuser', self.sd.boolean())),
216216
}
217-
user = get_user_model().objects.create(**params)
217+
user, _ = get_user_model().objects.get_or_create(**params)
218218
password = '123123'
219219

220220
user.set_password(password)

0 commit comments

Comments
 (0)