Skip to content

Commit

Permalink
Tweaks on the candidate strings
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Oct 29, 2024
1 parent 5d9bc9a commit 496c776
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 330 deletions.
22 changes: 12 additions & 10 deletions backend/hub/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@
path("", HomeView.as_view(), name="home"),
path(_("candidates/"), CandidateListView.as_view(), name="candidates"),
path(
_("candidates/register"),
_("candidates/register/"),
CandidateRegisterRequestCreateView.as_view(),
name="candidate-register-request",
),
path(_("candidates/<int:pk>"), CandidateDetailView.as_view(), name="candidate-detail"),
path(_("candidates/<int:pk>/vote"), candidate_vote, name="candidate-vote"),
path(_("candidates/<int:pk>/support"), candidate_support, name="candidate-support"),
path(_("candidates/<int:pk>/revoke"), candidate_revoke, name="candidate-revoke"),
path(_("candidates/<int:pk>/status-confirm"), candidate_status_confirm, name="candidate-status-confirm"),
path(_("candidates/<int:pk>/update"), CandidateUpdateView.as_view(), name="candidate-update"),
path(_("candidates/votes"), ElectorCandidatesListView.as_view(), name="votes"),
path(_("candidates/results"), CandidateResultsView.as_view(), name="results"),
path(_("candidates/ces-results"), RedirectView.as_view(pattern_name="results", permanent=True), name="ces-results"),
path(_("candidates/<int:pk>/"), CandidateDetailView.as_view(), name="candidate-detail"),
path(_("candidates/<int:pk>/vote/"), candidate_vote, name="candidate-vote"),
path(_("candidates/<int:pk>/support/"), candidate_support, name="candidate-support"),
path(_("candidates/<int:pk>/revoke/"), candidate_revoke, name="candidate-revoke"),
path(_("candidates/<int:pk>/status-confirm/"), candidate_status_confirm, name="candidate-status-confirm"),
path(_("candidates/<int:pk>/update/"), CandidateUpdateView.as_view(), name="candidate-update"),
path(_("candidates/votes/"), ElectorCandidatesListView.as_view(), name="votes"),
path(_("candidates/results/"), CandidateResultsView.as_view(), name="results"),
path(
_("candidates/ces-results/"), RedirectView.as_view(pattern_name="results", permanent=True), name="ces-results"
),
path(_("committee/ngos/"), CommitteeOrganizationListView.as_view(), name="committee-ngos"),
path(_("committee/candidates/"), CommitteeCandidatesListView.as_view(), name="committee-candidates"),
path(_("ngos/"), OrganizationListView.as_view(), name="ngos"),
Expand Down
29 changes: 15 additions & 14 deletions backend/hub/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,22 +622,23 @@ def _get_candidate_vote_context(user: User, candidate: Candidate) -> Dict[str, b

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user: User = self.request.user
candidate: Candidate = self.object

context["own_candidate"] = False

context["can_support_candidate"] = False
context["supported_candidate"] = False

context["can_approve_candidate"] = False
context["approved_candidate"] = False

context["can_vote_candidate"] = False
context["voted_candidate"] = False
context.update(
{
"own_candidate": False,
"can_support_candidate": False,
"supported_candidate": False,
"can_approve_candidate": False,
"approved_candidate": False,
"can_vote_candidate": False,
"voted_candidate": False,
"used_all_domain_votes": False,
"can_view_all_information": False,
}
)

context["used_all_domain_votes"] = False
context["can_view_all_information"] = False
user: User = self.request.user
candidate: Candidate = self.object

if user.is_anonymous:
return context
Expand Down
Loading

0 comments on commit 496c776

Please sign in to comment.