ericholscher / django-test-utils

Utilities for testing Django applications
http://django-test-utils.readthedocs.org/
MIT License
343 stars 69 forks source link

[makefixture] cannot create fixtures #28

Open viciu opened 12 years ago

viciu commented 12 years ago

When running e.g. manage.py makefixture auth.User an exception is thrown:

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.6/dist-packages/test_utils/management/commands/makefixture.py", line 126, in handle
    label_output = self.handle_label(labels, **options)
  File "/usr/local/lib/python2.6/dist-packages/test_utils/management/commands/makefixture.py", line 115, in handle_label
    return self.handle_models(parsed, **options)
  File "/usr/local/lib/python2.6/dist-packages/test_utils/management/commands/makefixture.py", line 53, in handle_models
    objects.extend(model._default_manager.filter(pk__exact=slice))
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 141, in filter
    return self.get_query_set().filter(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 550, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 568, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1194, in add_q
    can_reuse=used_aliases, force_having=force_having)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1129, in add_filter
    connector)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/where.py", line 67, in add
    value = obj.prepare(lookup_type, value)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/where.py", line 316, in prepare
    return self.field.get_prep_lookup(lookup_type, value)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/fields/__init__.py", line 292, in get_prep_lookup
    return self.get_prep_value(value)
  File "/usr/local/lib/python2.6/dist-packages/django/db/models/fields/__init__.py", line 479, in get_prep_value
    return int(value)
ValueError: invalid literal for int() with base 10: ''

I'm using django 1.3.1 and django-test-utils 0.3

ernop commented 12 years ago

this is fixed here https://github.com/ernop/django-test-utils/commit/b7ec7d9b8033270a9f7b8d7ebb0640bbe1d2da65