Skip to content

Commit

Permalink
Merge pull request #76 from dimagi/dm/django2
Browse files Browse the repository at this point in the history
Django 2 compatibility
  • Loading branch information
millerdev authored Mar 5, 2020
2 parents d0701cc + b7bba07 commit 32cba0c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions couchdbkit/ext/django/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from django.utils.text import camel_case_to_spaces as get_verbose_name

from django.conf import settings
from django.utils.translation import activate, deactivate_all, get_language, \
string_concat
from django.utils.text import format_lazy
from django.utils.translation import activate, deactivate_all, get_language
from django.utils.encoding import smart_str, force_text

from couchdbkit import schema
Expand Down Expand Up @@ -88,13 +88,14 @@ def contribute_to_class(self, cls, name):

# verbose_name_plural is a special case because it uses a 's'
# by default.
setattr(self, 'verbose_name_plural', meta_attrs.pop('verbose_name_plural', string_concat(self.verbose_name, 's')))
setattr(self, 'verbose_name_plural', meta_attrs.pop(
'verbose_name_plural', format_lazy('{}{}', self.verbose_name, 's')))

# Any leftover attributes must be invalid.
if meta_attrs != {}:
raise TypeError("'class Meta' got invalid attribute(s): %s" % ','.join(list(meta_attrs.keys())))
else:
self.verbose_name_plural = string_concat(self.verbose_name, 's')
self.verbose_name_plural = format_lazy('{}{}', self.verbose_name, 's')
del self.meta

def __str__(self):
Expand Down

0 comments on commit 32cba0c

Please sign in to comment.