joke2k / django-faker

Django-faker uses fake-factory to generate test data for Django models and templates
MIT License
246 stars 48 forks source link

'Generator' object has no attribute 'randomInt' #14

Closed jleeothon closed 1 year ago

jleeothon commented 10 years ago

Tried to use with a Python 3.4 project. Failed when tried to call Faker.getPopulator().

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django_faker import Faker
>>> populator = Faker.getPopulator()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/JohnnyLee/Projects/carcajou/lib/python3.4/site-packages/django_faker/__init__.py", line 90, in getPopulator
    generator = cls.generators.get(codename,  None) or cls.getGenerator(codename=codename)
  File "/Users/JohnnyLee/Projects/carcajou/lib/python3.4/site-packages/django_faker/__init__.py", line 58, in getGenerator
    cls.generators[codename].seed( cls.generators[codename].randomInt() )
AttributeError: 'Generator' object has no attribute 'randomInt'
crolfe commented 10 years ago

@jleeothon

I get the same error on Python 2.7.5, but had success installing from master: pip uninstall django-faker pip install git+git://github.com/joke2k/django-faker.git

edwinlunando commented 9 years ago

@joke2k would you please releasing a new fix to pypi. Thanks.

Brobin commented 9 years ago

This is because the faker library itself has changed its API. It doesn't look like @joke2k is maintaining this package anymore. I've started my own fork To try to fix these issues and also support Python 3 and Django 1.8.