diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py index 8e25554aea..0da7e8e453 100644 --- a/django/contrib/humanize/templatetags/humanize.py +++ b/django/contrib/humanize/templatetags/humanize.py @@ -165,13 +165,13 @@ def naturaltime(value): return ungettext( u'a second ago', u'%(count)s seconds ago', delta.seconds ) % {'count': delta.seconds} - elif delta.seconds / 60 < 60: - count = delta.seconds / 60 + elif delta.seconds // 60 < 60: + count = delta.seconds // 60 return ungettext( u'a minute ago', u'%(count)s minutes ago', count ) % {'count': count} else: - count = delta.seconds / 60 / 60 + count = delta.seconds // 60 // 60 return ungettext( u'an hour ago', u'%(count)s hours ago', count ) % {'count': count} @@ -187,13 +187,13 @@ def naturaltime(value): return ungettext( u'a second from now', u'%(count)s seconds from now', delta.seconds ) % {'count': delta.seconds} - elif delta.seconds / 60 < 60: - count = delta.seconds / 60 + elif delta.seconds // 60 < 60: + count = delta.seconds // 60 return ungettext( u'a minute from now', u'%(count)s minutes from now', count ) % {'count': count} else: - count = delta.seconds / 60 / 60 + count = delta.seconds // 60 // 60 return ungettext( u'an hour from now', u'%(count)s hours from now', count ) % {'count': count} diff --git a/django/contrib/localflavor/se/utils.py b/django/contrib/localflavor/se/utils.py index 5f65d8fcb2..5e7c2b7dae 100644 --- a/django/contrib/localflavor/se/utils.py +++ b/django/contrib/localflavor/se/utils.py @@ -18,7 +18,7 @@ def id_number_checksum(gd): if (s % 10) == 0: return 0 - return (((s / 10) + 1) * 10) - s + return (((s // 10) + 1) * 10) - s def validate_id_birthday(gd, fix_coordination_number_day=True): """ diff --git a/django/utils/baseconv.py b/django/utils/baseconv.py index 702c172b34..8a6181bb2d 100644 --- a/django/utils/baseconv.py +++ b/django/utils/baseconv.py @@ -88,7 +88,7 @@ class BaseConverter(object): while x > 0: digit = x % len(to_digits) res = to_digits[digit] + res - x = int(x / len(to_digits)) + x = int(x // len(to_digits)) return neg, res base2 = BaseConverter(BASE2_ALPHABET) diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 28a83f2f42..aa3a729a8a 100644 --- a/django/utils/feedgenerator.py +++ b/django/utils/feedgenerator.py @@ -42,7 +42,7 @@ def rfc2822_date(date): time_str = date.strftime('%s, %%d %s %%Y %%H:%%M:%%S ' % (dow, month)) if date.tzinfo: offset = date.tzinfo.utcoffset(date) - timezone = (offset.days * 24 * 60) + (offset.seconds / 60) + timezone = (offset.days * 24 * 60) + (offset.seconds // 60) hour, minute = divmod(timezone, 60) return time_str + "%+03d%02d" % (hour, minute) else: @@ -54,7 +54,7 @@ def rfc3339_date(date): if date.tzinfo: time_str = date.strftime('%Y-%m-%dT%H:%M:%S') offset = date.tzinfo.utcoffset(date) - timezone = (offset.days * 24 * 60) + (offset.seconds / 60) + timezone = (offset.days * 24 * 60) + (offset.seconds // 60) hour, minute = divmod(timezone, 60) return time_str + "%+03d:%02d" % (hour, minute) else: diff --git a/django/utils/http.py b/django/utils/http.py index 4fee731d0a..af44ff498c 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -166,7 +166,7 @@ def int_to_base36(i): # Construct base36 representation while factor >= 0: j = 36 ** factor - base36.append(digits[i / j]) + base36.append(digits[i // j]) i = i % j factor -= 1 return ''.join(base36)