Skip to content

Commit

Permalink
Preselect default categories when creating problems (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
jalsol authored Jan 14, 2024
1 parent a7d09d8 commit 261841b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions judge/views/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,14 @@ def get_initial(self):
initial['description'] = misc_config(self.request)['misc_config']['description_example']
initial['memory_limit'] = 262144 # 256 MB
initial['partial'] = True
try:
initial['group'] = ProblemGroup.objects.get(name='Uncategorized').pk
except ProblemGroup.DoesNotExist:
initial['group'] = ProblemGroup.objects.order_by('id').first().pk
try:
initial['types'] = ProblemType.objects.get(name='uncategorized').pk
except ProblemType.DoesNotExist:
initial['types'] = ProblemType.objects.order_by('id').first().pk
return initial


Expand Down

0 comments on commit 261841b

Please sign in to comment.