Fixed the previous commit for Python3.

This commit is contained in:
Florian Apolloner 2014-07-30 22:22:04 +02:00
parent 97a38de230
commit 4453c80634
1 changed files with 3 additions and 2 deletions

View File

@ -10,6 +10,7 @@ except ImportError:
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):
@ -43,14 +44,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: