mirror of
https://github.com/django/django.git
synced 2025-03-26 09:10:50 +00:00
[1.7.x] Fixed the previous commit for Python3.
Backport of 4453c80634fb72b60e849480e52c06b570c696d5 from master.
This commit is contained in:
parent
e22ad1c325
commit
567ae0d529
@ -12,6 +12,7 @@ except ImproperlyConfigured:
|
|||||||
from django.core.files.storage import FileSystemStorage
|
from django.core.files.storage import FileSystemStorage
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.fields.files import ImageFieldFile, ImageField
|
from django.db.models.fields.files import ImageFieldFile, ImageField
|
||||||
|
from django.utils import six
|
||||||
|
|
||||||
|
|
||||||
class Foo(models.Model):
|
class Foo(models.Model):
|
||||||
@ -45,14 +46,14 @@ class Whiz(models.Model):
|
|||||||
c = models.IntegerField(choices=CHOICES, null=True)
|
c = models.IntegerField(choices=CHOICES, null=True)
|
||||||
|
|
||||||
|
|
||||||
class Counter:
|
class Counter(six.Iterator):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.n = 1
|
self.n = 1
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def next(self): # Python 3: def __next__(self)
|
def __next__(self):
|
||||||
if self.n > 5:
|
if self.n > 5:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user