diff --git a/judge/views/blog.py b/judge/views/blog.py index 42cecb7..2398703 100644 --- a/judge/views/blog.py +++ b/judge/views/blog.py @@ -200,22 +200,20 @@ class PostView(TitleMixin, CommentedDetailView): def get_context_data(self, **kwargs): context = super(PostView, self).get_context_data(**kwargs) context["og_image"] = self.object.og_image - context["valid_user"] = False - context["valid_org"] = [] - for author in self.object.authors.all(): - if self.request.profile.user == author.user: - context["valid_user"] = True + context["valid_user_to_show_edit"] = False + context["valid_org_to_show_edit"] = [] + + if self.request.profile in self.object.authors.all(): + context["valid_user_to_show_edit"] = True - for valid_org in self.object.organizations.all(): - for admin in valid_org.admins.all(): - if self.request.profile.user == admin.user: - context["valid_user"] = True + for valid_org_to_show_edit in self.object.organizations.all(): + if self.request.profile in valid_org_to_show_edit.admins.all(): + context["valid_user_to_show_edit"] = True - if context["valid_user"]: + if context["valid_user_to_show_edit"]: for post_org in self.object.organizations.all(): - for org in self.request.profile.organizations.all(): - if post_org == org: - context["valid_org"].append(org) + if post_org in self.request.profile.organizations.all(): + context["valid_org_to_show_edit"].append(post_org) return context diff --git a/locale/vi/LC_MESSAGES/django.po b/locale/vi/LC_MESSAGES/django.po index ac4da17..e89ac73 100644 --- a/locale/vi/LC_MESSAGES/django.po +++ b/locale/vi/LC_MESSAGES/django.po @@ -3361,6 +3361,10 @@ msgstr "đã đăng vào %(time)s" msgid "Edit" msgstr "Chỉnh sửa" +#: templates/blog/blog.html:33 +msgid "Edit in" +msgstr "Chỉnh sửa trong" + #: templates/blog/dashboard.html:21 #, python-format msgid "" diff --git a/locale/vi/LC_MESSAGES/dmoj-user.po b/locale/vi/LC_MESSAGES/dmoj-user.po index 31bcd80..3e14530 100644 --- a/locale/vi/LC_MESSAGES/dmoj-user.po +++ b/locale/vi/LC_MESSAGES/dmoj-user.po @@ -15,6 +15,9 @@ msgstr "Thành viên" msgid "Contests" msgstr "Kỳ thi" +msgid "Chat" +msgstr "" + msgid "Groups" msgstr "Nhóm" @@ -24,563 +27,20 @@ msgstr "Giới thiệu" msgid "Status" msgstr "Máy chấm" -msgid "Suggestions" -msgstr "Đề xuất ý tưởng" - -msgid "Proposal" -msgstr "Đề xuất bài tập" - -msgid "TanKhoa" -msgstr "Tân Khoa" - -msgid "Name" -msgstr "Đăng ký tên" - -msgid "Report" -msgstr "Báo cáo" - -msgid "2sat" -msgstr "" - -msgid "adhoc" -msgstr "" - -msgid "aho-corasick" -msgstr "" - -msgid "articulation-point" -msgstr "" - -msgid "backtrack" -msgstr "" - -msgid "bellman-ford" -msgstr "" - -msgid "bfs-01" -msgstr "" - -msgid "biconnected-component" -msgstr "" - -msgid "bignum" -msgstr "" - -msgid "binary-lifting" -msgstr "" - -msgid "binary-search" -msgstr "" - -msgid "binary-search-parallel" -msgstr "" - -msgid "bit" -msgstr "" - -msgid "bit2d" -msgstr "" - -msgid "bitset" -msgstr "" - -msgid "bitwise" -msgstr "" - -msgid "block-cut-tree" -msgstr "" - -msgid "boruvka" -msgstr "" - -msgid "branch&bound" -msgstr "" - -msgid "bridge" -msgstr "" - -msgid "brute force" -msgstr "" - -msgid "cactus-graph" -msgstr "" - -msgid "casework" -msgstr "" - -msgid "centroid" -msgstr "" - -msgid "chinese-remainder" -msgstr "" - -msgid "combinatorics" -msgstr "" - -msgid "constructive" -msgstr "" - -msgid "convex-hull" -msgstr "" - -msgid "counting" -msgstr "" - -msgid "cycle" -msgstr "" - -msgid "data structures" -msgstr "" - -msgid "deep-optimization" -msgstr "" - -msgid "dfs/bfs/pfs" -msgstr "" - -msgid "dijkstra" -msgstr "" - -msgid "divide and conquer" -msgstr "" - -msgid "dp-alien" -msgstr "" - -msgid "dp-bitmask" -msgstr "" - -msgid "dp-cc" -msgstr "" - -msgid "dp-convexhull" -msgstr "" - -msgid "dp-count" -msgstr "" - -msgid "dp-dag" -msgstr "" - -msgid "dp-digit" -msgstr "" - -msgid "dp-dnc" -msgstr "" - -msgid "dp-general" -msgstr "" - -msgid "dp-knuth" -msgstr "" - -msgid "dp-matrix" -msgstr "" - -msgid "dp-openclose" -msgstr "" - -msgid "dp-permutation" -msgstr "" - -msgid "dp-slope" -msgstr "" - -msgid "dp-sos" -msgstr "" - -msgid "dp-swap-label" -msgstr "" - -msgid "dp-tree" -msgstr "" - -msgid "dsu" -msgstr "" - -msgid "dsu-roll-back" -msgstr "" - -msgid "dynamic programming" -msgstr "" - -msgid "euler-path" -msgstr "" - -msgid "euler-theorem" -msgstr "" - -msgid "euler-tour" -msgstr "" - -msgid "extgcd" -msgstr "" - -msgid "Fenwick Tree (Binary Indexed Tree)" -msgstr "" - -msgid "fft/ntt" -msgstr "" - -msgid "flow-demands" -msgstr "" - -msgid "flow-general" -msgstr "" - -msgid "flow-mincost" -msgstr "" - -msgid "flows" -msgstr "" - -msgid "floyd" -msgstr "" - -msgid "function-graph" -msgstr "" - -msgid "game theory" -msgstr "" - -msgid "game-ad-hoc" -msgstr "" - -msgid "game-minimax" -msgstr "" - -msgid "game-nim" -msgstr "" - -msgid "game-sprague-grundy" -msgstr "" - -msgid "gauss-elim" -msgstr "" - -msgid "genetic" -msgstr "" - -msgid "geometry" -msgstr "" - -msgid "geometry-general" -msgstr "" - -msgid "gomory-hu-tree" -msgstr "" - -msgid "graph" -msgstr "" - -msgid "graph theory" -msgstr "" - -msgid "greedy" -msgstr "" - -msgid "greedy-exchange" -msgstr "" - -msgid "greedy-general" -msgstr "" - -msgid "greedy-moore" -msgstr "" - -msgid "hashing" -msgstr "" - -msgid "heuristic" -msgstr "" - -msgid "hld" -msgstr "" - -msgid "HSG" -msgstr "" - -msgid "ICPC" -msgstr "" - -msgid "implementation" +msgid "Simple Math" msgstr "" -msgid "inclusion-exclusion" -msgstr "" - -msgid "interactive" -msgstr "" - -msgid "inversive-geometry" -msgstr "" - -msgid "kd-tree" -msgstr "" - -msgid "kirchoff" -msgstr "" - -msgid "kmp" -msgstr "" - -msgid "kruskal" -msgstr "" - -msgid "lagrange-inter" -msgstr "" - -msgid "language" -msgstr "" - -msgid "lca" -msgstr "" - -msgid "lichao-tree" -msgstr "" - -msgid "local-search" -msgstr "" +#~ msgid "Suggestions" +#~ msgstr "Đề xuất ý tưởng" -msgid "ltt" -msgstr "" - -msgid "manacher" -msgstr "" - -msgid "matching-bipartie" -msgstr "" - -msgid "matching-general" -msgstr "" - -msgid "matching-hall" -msgstr "" +#~ msgid "Proposal" +#~ msgstr "Đề xuất bài tập" -msgid "matching-hungarian" -msgstr "" - -msgid "matching-konig" -msgstr "" +#~ msgid "TanKhoa" +#~ msgstr "Tân Khoa" -msgid "math" -msgstr "" - -msgid "math-general" -msgstr "" - -msgid "matrix multiplication" -msgstr "" - -msgid "max-clique" -msgstr "" - -msgid "meet-in-the-middle" -msgstr "" - -msgid "Miscellaneous" -msgstr "" +#~ msgid "Name" +#~ msgstr "Đăng ký tên" -msgid "mo-general" -msgstr "" - -msgid "mo-tree" -msgstr "" - -msgid "mo-update" -msgstr "" - -msgid "mobius" -msgstr "" - -msgid "modular" -msgstr "" - -msgid "modular-inverse" -msgstr "" - -msgid "monotonic-queue" -msgstr "" - -msgid "multiplicative" -msgstr "" - -msgid "NEW" -msgstr "" - -msgid "number theory" -msgstr "" - -msgid "offline" -msgstr "" - -msgid "order-statistic" -msgstr "" - -msgid "output-only" -msgstr "" - -msgid "palin-tree" -msgstr "" - -msgid "picks-theorem" -msgstr "" - -msgid "planar-graph" -msgstr "" - -msgid "polygon-triangulation" -msgstr "" - -msgid "precision-issue" -msgstr "" - -msgid "prefix-sum" -msgstr "" - -msgid "primality-test" -msgstr "" - -msgid "probability" -msgstr "" - -msgid "randomized" -msgstr "" - -msgid "Range Queries" -msgstr "" - -msgid "recursion" -msgstr "" - -msgid "rmq" -msgstr "" - -msgid "rmq-2d" -msgstr "" - -msgid "rmq2d" -msgstr "" - -msgid "scc" -msgstr "" - -msgid "scheduling" -msgstr "" - -msgid "search" -msgstr "" - -msgid "segtree-2d" -msgstr "" - -msgid "segtree-beats" -msgstr "" - -msgid "segtree-dynamic" -msgstr "" - -msgid "segtree-general" -msgstr "" - -msgid "segtree-persistent" -msgstr "" - -msgid "segtree-walk" -msgstr "" - -msgid "sequence" -msgstr "" - -msgid "sieve" -msgstr "" - -msgid "sieve-segment" -msgstr "" - -msgid "small-to-large" -msgstr "" - -msgid "sortings" -msgstr "" - -msgid "spanning-tree" -msgstr "" - -msgid "sparse-table" -msgstr "" - -msgid "spfa" -msgstr "" - -msgid "sqrt" -msgstr "" - -msgid "sqrt-babygiant" -msgstr "" - -msgid "sqrt-buckets" -msgstr "" - -msgid "sqrt-buffer" -msgstr "" - -msgid "sqrt-time" -msgstr "" - -msgid "stack-queue" -msgstr "" - -msgid "static-data" -msgstr "" - -msgid "stl" -msgstr "" - -msgid "string" -msgstr "" - -msgid "suffix-array" -msgstr "" - -msgid "sweep-line" -msgstr "" - -msgid "ternary-search" -msgstr "" - -msgid "topo-sort" -msgstr "" - -msgid "tortoise-hare" -msgstr "" - -msgid "treap/splay" -msgstr "" - -msgid "Tree - general" -msgstr "" - -msgid "tree-isomorphism" -msgstr "" - -msgid "trie" -msgstr "" - -msgid "TSP" -msgstr "" - -msgid "TST" -msgstr "" - -msgid "two-pointers" -msgstr "" - -msgid "VOI" -msgstr "" - -msgid "voronoi" -msgstr "" - -msgid "z-function" -msgstr "" +#~ msgid "Report" +#~ msgstr "Báo cáo" diff --git a/templates/blog/blog.html b/templates/blog/blog.html index f526732..9cbfecb 100644 --- a/templates/blog/blog.html +++ b/templates/blog/blog.html @@ -28,8 +28,8 @@ {% if post.is_editable_by(request.user) %} [{{ _('Edit') }}] - {% elif valid_user %} - {% for org in valid_org %} + {% elif valid_user_to_show_edit %} + {% for org in valid_org_to_show_edit %} [{{ _('Edit in') }} {{org.slug}}] {% endfor %} {% endif %}