Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require a solved problem to create a new ticket out of contest #1639

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions judge/views/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def clean(self):
profile = self.request.profile
if profile.mute:
raise ValidationError(_('Your part is silent, little toad.'))
if not self.request.in_contest and not profile.has_any_solves:
raise ValidationError(_('You must solve at least one problem before you can create a ticket.'))
return super(TicketForm, self).clean()


Expand Down
3 changes: 2 additions & 1 deletion templates/ticket/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
{% block guideline_message %}{% endblock %}
{% csrf_token %}
<div class="title-block{% if form.title.errors %} error{% endif %}">{{ form.title }}</div>
{% if form.title.errors or form.body.errors %}
{% if form.errors %}
<div class="form-errors">
{{ form.non_field_errors() }}
{{ form.title.errors }}
{{ form.body.errors }}
</div>
Expand Down