Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

fix for django 2.1/2.2 #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions django_postgres_extensions/admin/options.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from django.contrib.admin.options import ModelAdmin
from django.utils.translation import string_concat, ugettext as _
from django.utils.translation import ugettext as _
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be gettest

from django.utils.text import format_lazy
from django.forms.widgets import CheckboxSelectMultiple, SelectMultiple
from django_postgres_extensions.models import ArrayManyToManyField
from django.contrib.admin import widgets


class PostgresAdmin(ModelAdmin):

def formfield_for_manytomany(self, db_field, request=None, **kwargs):
Expand Down Expand Up @@ -35,7 +37,7 @@ def formfield_for_manytomany(self, db_field, request=None, **kwargs):
if isinstance(form_field.widget, SelectMultiple) and not isinstance(form_field.widget, CheckboxSelectMultiple):
msg = _('Hold down "Control", or "Command" on a Mac, to select more than one.')
help_text = form_field.help_text
form_field.help_text = string_concat(help_text, ' ', msg) if help_text else msg
form_field.help_text = format_lazy('{} {}', (help_text, msg)) if help_text else msg
return form_field

def formfield_for_dbfield(self, db_field, request, **kwargs):
Expand Down Expand Up @@ -70,4 +72,4 @@ def formfield_for_dbfield(self, db_field, request, **kwargs):

return formfield
else:
return super(PostgresAdmin, self).formfield_for_dbfield(db_field, request, **kwargs)
return super(PostgresAdmin, self).formfield_for_dbfield(db_field, request, **kwargs)