diff --git a/judge/views/blog.py b/judge/views/blog.py index c6421b7..c3f27d8 100644 --- a/judge/views/blog.py +++ b/judge/views/blog.py @@ -186,21 +186,17 @@ class PostView(TitleMixin, CommentedDetailView, PageVoteDetailView, BookMarkDeta context["og_image"] = self.object.og_image context["editable_orgs"] = [] - can_edit = False orgs = list(self.object.organizations.all()) if self.request.profile: if self.request.profile.id in self.object.get_authors(): - can_edit = True - - for org in orgs: - if org.is_admin(self.request.profile): - can_edit = True - - if can_edit: - for org in orgs: - if org.is_member(self.request.profile): - context["editable_orgs"].append(org) + for org in orgs: + if org.is_member(self.request.profile): + context["editable_orgs"].append(org) + else: + for org in orgs: + if org.is_admin(self.request.profile): + context["editable_orgs"].append(org) return context diff --git a/judge/views/contests.py b/judge/views/contests.py index f902aef..d9c1f81 100644 --- a/judge/views/contests.py +++ b/judge/views/contests.py @@ -468,6 +468,10 @@ class ContestDetail( ) context["editable_organizations"] = self.get_editable_organizations() context["is_clonable"] = is_contest_clonable(self.request, self.object) + if self.request.in_contest: + context["current_contest"] = self.request.participation.contest + else: + context["current_contest"] = None return context @@ -587,12 +591,7 @@ class ContestJoin(LoginRequiredMixin, ContestMixin, BaseDetailView): profile = request.profile if profile.current_contest is not None: - return generic_message( - request, - _("Already in contest"), - _('You are already in a contest: "%s".') - % profile.current_contest.contest.name, - ) + profile.remove_contest() if ( not request.user.is_superuser @@ -671,6 +670,7 @@ class ContestJoin(LoginRequiredMixin, ContestMixin, BaseDetailView): profile.save() contest._updating_stats_only = True contest.update_user_count() + request.session["contest_mode"] = True return HttpResponseRedirect(reverse("problem_list")) def ask_for_access_code(self, form=None): diff --git a/locale/vi/LC_MESSAGES/django.po b/locale/vi/LC_MESSAGES/django.po index 95eea34..7838fd5 100644 --- a/locale/vi/LC_MESSAGES/django.po +++ b/locale/vi/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: lqdoj2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-23 14:12+0700\n" +"POT-Creation-Date: 2024-04-25 10:33+0700\n" "PO-Revision-Date: 2021-07-20 03:44\n" "Last-Translator: Icyene\n" "Language-Team: Vietnamese\n" @@ -118,7 +118,7 @@ msgid "Included contests" msgstr "" #: judge/admin/contest.py:80 judge/admin/volunteer.py:54 -#: templates/contest/clarification.html:42 templates/contest/contest.html:120 +#: templates/contest/clarification.html:42 templates/contest/contest.html:116 #: templates/contest/moss.html:41 templates/internal/left-sidebar.html:2 #: templates/internal/problem/problem.html:41 templates/problem/list.html:17 #: templates/problem/list.html:34 templates/problem/list.html:153 @@ -138,9 +138,9 @@ msgstr "" msgid "Details" msgstr "Chi tiết" -#: judge/admin/contest.py:187 templates/contest/list.html:261 -#: templates/contest/list.html:301 templates/contest/list.html:345 -#: templates/contest/list.html:382 +#: judge/admin/contest.py:187 templates/contest/list.html:266 +#: templates/contest/list.html:306 templates/contest/list.html:350 +#: templates/contest/list.html:387 msgid "Format" msgstr "Thể thức" @@ -253,7 +253,7 @@ msgid "Taxonomy" msgstr "" #: judge/admin/problem.py:230 judge/admin/problem.py:463 -#: templates/contest/contest.html:121 +#: templates/contest/contest.html:117 #: templates/contest/contests_summary.html:41 templates/problem/data.html:536 #: templates/problem/list.html:22 templates/problem/list.html:48 #: templates/user/base-users-table.html:10 templates/user/user-about.html:36 @@ -426,9 +426,9 @@ msgstr[0] "%d bài nộp đã được tính điểm lại." msgid "Rescore the selected submissions" msgstr "Tính điểm lại cái bài nộp" -#: judge/admin/submission.py:332 templates/contest/list.html:246 -#: templates/contest/list.html:290 templates/contest/list.html:334 -#: templates/contest/list.html:376 templates/notification/list.html:12 +#: judge/admin/submission.py:332 templates/contest/list.html:251 +#: templates/contest/list.html:295 templates/contest/list.html:339 +#: templates/contest/list.html:381 templates/notification/list.html:12 #: templates/organization/requests/log.html:10 #: templates/organization/requests/pending.html:20 #: templates/problem/list.html:154 @@ -2788,141 +2788,132 @@ msgstr "Bạn phải giải ít nhất một bài trước khi được phép b msgid "Posted comment" msgstr "Bình luận đã đăng" -#: judge/views/contests.py:122 judge/views/contests.py:406 -#: judge/views/contests.py:411 judge/views/contests.py:708 +#: judge/views/contests.py:122 judge/views/contests.py:405 +#: judge/views/contests.py:410 judge/views/contests.py:710 msgid "No such contest" msgstr "Không có contest nào như vậy" -#: judge/views/contests.py:123 judge/views/contests.py:407 +#: judge/views/contests.py:123 judge/views/contests.py:406 #, python-format msgid "Could not find a contest with the key \"%s\"." msgstr "Không tìm thấy kỳ thi với mã \"%s\"." -#: judge/views/contests.py:142 judge/views/contests.py:1478 -#: judge/views/stats.py:178 templates/contest/list.html:242 -#: templates/contest/list.html:286 templates/contest/list.html:330 -#: templates/contest/list.html:372 +#: judge/views/contests.py:142 judge/views/contests.py:1480 +#: judge/views/stats.py:178 templates/contest/list.html:247 +#: templates/contest/list.html:291 templates/contest/list.html:335 +#: templates/contest/list.html:377 #: templates/organization/org-left-sidebar.html:5 templates/stats/site.html:21 #: templates/user/user-bookmarks.html:56 msgid "Contests" msgstr "Kỳ thi" -#: judge/views/contests.py:411 +#: judge/views/contests.py:410 msgid "Could not find such contest." msgstr "Không tìm thấy kỳ thi nào như vậy." -#: judge/views/contests.py:419 +#: judge/views/contests.py:418 #, python-format msgid "Access to contest \"%s\" denied" msgstr "Truy cập tới kỳ thi \"%s\" bị từ chối" -#: judge/views/contests.py:490 +#: judge/views/contests.py:496 msgid "Clone Contest" msgstr "Nhân bản kỳ thi" -#: judge/views/contests.py:582 +#: judge/views/contests.py:588 msgid "Contest not ongoing" msgstr "Kỳ thi đang không diễn ra" -#: judge/views/contests.py:583 +#: judge/views/contests.py:589 #, python-format msgid "\"%s\" is not currently ongoing." msgstr "\"%s\" kỳ thi đang không diễn ra." -#: judge/views/contests.py:590 -msgid "Already in contest" -msgstr "Đã ở trong kỳ thi" - -#: judge/views/contests.py:591 -#, python-format -msgid "You are already in a contest: \"%s\"." -msgstr "Bạn đã ở trong kỳ thi: \"%s\"." - -#: judge/views/contests.py:601 +#: judge/views/contests.py:602 msgid "Banned from joining" msgstr "Bị cấm tham gia" -#: judge/views/contests.py:603 +#: judge/views/contests.py:604 msgid "" "You have been declared persona non grata for this contest. You are " "permanently barred from joining this contest." msgstr "Bạn không được phép tham gia kỳ thi này." -#: judge/views/contests.py:692 +#: judge/views/contests.py:694 #, python-format msgid "Enter access code for \"%s\"" msgstr "Nhập mật khẩu truy cập cho \"%s\"" -#: judge/views/contests.py:709 +#: judge/views/contests.py:711 #, python-format msgid "You are not in contest \"%s\"." msgstr "Bạn không ở trong kỳ thi \"%s\"." -#: judge/views/contests.py:732 +#: judge/views/contests.py:734 msgid "ContestCalendar requires integer year and month" msgstr "Lịch thi yêu cầu giá trị cho năm và tháng là số nguyên" -#: judge/views/contests.py:790 +#: judge/views/contests.py:792 #, python-format msgid "Contests in %(month)s" msgstr "Các kỳ thi trong %(month)s" -#: judge/views/contests.py:791 +#: judge/views/contests.py:793 msgid "F Y" msgstr "F Y" -#: judge/views/contests.py:851 +#: judge/views/contests.py:853 #, python-format msgid "%s Statistics" msgstr "%s Thống kê" -#: judge/views/contests.py:1159 +#: judge/views/contests.py:1161 #, python-format msgid "%s Rankings" msgstr "%s Bảng điểm" -#: judge/views/contests.py:1170 +#: judge/views/contests.py:1172 msgid "???" msgstr "???" -#: judge/views/contests.py:1197 +#: judge/views/contests.py:1199 #, python-format msgid "Your participation in %s" msgstr "Lần tham gia trong %s" -#: judge/views/contests.py:1198 +#: judge/views/contests.py:1200 #, python-format msgid "%s's participation in %s" msgstr "Lần tham gia của %s trong %s" -#: judge/views/contests.py:1212 +#: judge/views/contests.py:1214 msgid "Live" msgstr "Trực tiếp" -#: judge/views/contests.py:1231 templates/contest/contest-tabs.html:21 +#: judge/views/contests.py:1233 templates/contest/contest-tabs.html:21 msgid "Participation" msgstr "Lần tham gia" -#: judge/views/contests.py:1280 +#: judge/views/contests.py:1282 #, python-format msgid "%s MOSS Results" msgstr "%s Kết quả MOSS" -#: judge/views/contests.py:1316 +#: judge/views/contests.py:1318 #, python-format msgid "Running MOSS for %s..." msgstr "Đang chạy MOSS cho %s..." -#: judge/views/contests.py:1339 +#: judge/views/contests.py:1341 #, python-format msgid "Contest tag: %s" msgstr "Nhãn kỳ thi: %s" -#: judge/views/contests.py:1354 judge/views/ticket.py:67 +#: judge/views/contests.py:1356 judge/views/ticket.py:67 msgid "Issue description" msgstr "Mô tả vấn đề" -#: judge/views/contests.py:1397 +#: judge/views/contests.py:1399 #, python-format msgid "New clarification for %s" msgstr "Thông báo mới cho %s" @@ -3065,7 +3056,7 @@ msgid "You are not allowed to access this organization." msgstr "Bạn không được phép chỉnh sửa tổ chức này." #: judge/views/organization.py:245 judge/views/stats.py:184 -#: templates/contest/list.html:89 templates/problem/list-base.html:91 +#: templates/contest/list.html:94 templates/problem/list-base.html:91 #: templates/stats/site.html:33 templates/user/user-left-sidebar.html:4 #: templates/user/user-list-tabs.html:6 msgid "Groups" @@ -3212,7 +3203,7 @@ msgstr "Bạn không được phép chỉnh sửa tổ chức này." #: judge/views/organization.py:960 templates/blog/blog.html:31 #: templates/comments/content-list.html:53 #: templates/comments/content-list.html:66 -#: templates/contest/contest-tabs.html:37 templates/contest/list.html:123 +#: templates/contest/contest-tabs.html:37 templates/contest/list.html:128 #: templates/contest/tag-title.html:9 templates/flatpages/admin_link.html:3 #: templates/license.html:10 templates/problem/editorial.html:15 #: templates/problem/feed/items.html:50 @@ -3258,7 +3249,7 @@ msgstr "Hướng dẫn cho {0}" msgid "Editorial for {0}" msgstr "Hướng dẫn cho {0}" -#: judge/views/problem.py:458 templates/contest/contest.html:116 +#: judge/views/problem.py:458 templates/contest/contest.html:112 #: templates/course/lesson.html:14 #: templates/organization/org-left-sidebar.html:4 #: templates/user/user-about.html:28 templates/user/user-bookmarks.html:35 @@ -3266,38 +3257,38 @@ msgstr "Hướng dẫn cho {0}" msgid "Problems" msgstr "Bài tập" -#: judge/views/problem.py:825 +#: judge/views/problem.py:824 msgid "Problem feed" msgstr "Bài tập" -#: judge/views/problem.py:1023 judge/views/problem.py:1056 +#: judge/views/problem.py:1022 judge/views/problem.py:1055 msgid "