Skip to content

Commit

Permalink
Replace ungettext by ngettext following deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Feb 1, 2022
1 parent b59bf69 commit 2030074
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions survey/actions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ungettext
from django.utils.translation import ngettext


def make_published(modeladmin, request, queryset):
"""
Mark the given survey as published
"""
count = queryset.update(is_published=True)
message = ungettext(
message = ngettext(
"%(count)d survey was successfully marked as published.",
"%(count)d surveys were successfully marked as published",
count,
Expand Down
4 changes: 2 additions & 2 deletions survey/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.contrib import messages
from django.shortcuts import Http404, get_object_or_404, redirect, reverse
from django.utils.translation import ugettext
from django.utils.translation import gettext_lazy as _

from survey.models import Survey

Expand All @@ -24,7 +24,7 @@ def survey_check(self, request, *args, **kwargs):
if survey.expire_date < date.today():
msg = "Survey is not published anymore. It was published until: '%s'."
logging.warning(msg, survey.expire_date)
messages.warning(request, ugettext("This survey has expired for new submissions."))
messages.warning(request, _("This survey has expired for new submissions."))
return redirect(reverse("survey-list"))
if survey.publish_date > date.today():
msg = "Survey is not yet published. It is due: '%s'."
Expand Down
4 changes: 2 additions & 2 deletions survey/exporter/tex/question2tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.conf import settings
from django.utils.translation import gettext_lazy as _
from django.utils.translation import ungettext
from django.utils.translation import ngettext

from survey.models import Question

Expand Down Expand Up @@ -60,7 +60,7 @@ def get_caption_min_cardinality(self):
if self.min_cardinality > 0:
caption += "{} {} ".format(
_("with"),
ungettext(
ngettext(
"%(min_cardinality)d respondents or more",
"%(min_cardinality)d respondent or more",
self.min_cardinality,
Expand Down

0 comments on commit 2030074

Please sign in to comment.