Hi,

I'm having some trouble setting up a fixture for a model (Dataset)
that has a many-to-one relation with another model, DataSource. My
initial try at this was to put "datasource_id": "1" (the "1" points to
a datasource fixture in another file) in the dataset fixture, but that
results in
"Problem installing fixture '/dev/myproject/myapp/fixtures/
datasets.json': Dataset has no field named u'datasource_id'". I
initially thought that the datasource_id field in the db wasn't being
created, but a look at the generated sql as well as a peek at the
database itself shows this not to be the case. The error instead seems
to refer to the model itself, which has the declaration:

"datasource  = models.ForeignKey(DataSource)"

I tried changing the fixture line to "datasource": "1", but this
results in the stack trace below. Does anyone know how to set up this
fixture properly?

Thanks,
James

 Traceback (most recent call last):
  File "manage.py", line 11, in ?
    execute_manager(settings)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 1669, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 1583, in execute_from_command_line
    action_mapping[action](args[1:], int(options.verbosity))
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 1306, in test
    failures = test_runner(app_list, verbosity)
  File "/usr/lib/python2.4/site-packages/django/test/simple.py", line
82, in run_tests
    result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
  File "/usr/lib/python2.4/unittest.py", line 696, in run
    test(result)
  File "/usr/lib/python2.4/unittest.py", line 428, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.4/unittest.py", line 424, in run
    test(result)
  File "/usr/lib/python2.4/unittest.py", line 428, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.4/unittest.py", line 424, in run
    test(result)
  File "/usr/lib/python2.4/unittest.py", line 428, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.4/unittest.py", line 424, in run
    test(result)
  File "/usr/lib/python2.4/unittest.py", line 428, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.4/unittest.py", line 424, in run
    test(result)
  File "/usr/lib/python2.4/unittest.py", line 281, in __call__
    return self.run(*args, **kwds)
  File "/usr/lib/python2.4/site-packages/django/test/testcases.py",
line 49, in run
    self.install_fixtures()
  File "/usr/lib/python2.4/site-packages/django/test/testcases.py",
line 39, in install_fixtures
    management.flush(verbosity=0, interactive=False)
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 693, in flush
    sql_list = get_sql_flush()
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 359, in get_sql_flush
    statements = backend.get_sql_flush(style, _get_table_list(),
_get_sequence_list())
  File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 68, in _get_table_list
    cursor = connection.cursor()
  File "/usr/lib/python2.4/site-packages/django/db/backends/
postgresql_psycopg2/base.py", line 50, in cursor
    cursor = self.connection.cursor()
psycopg2.InterfaceError: connection already closed


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to