mediathread icon indicating copy to clipboard operation
mediathread copied to clipboard

AssertionError: ForeignKey(None) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string 'self'

Open natea opened this issue 13 years ago • 6 comments

When I try to start up Mediathread, I'm getting this error:

Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.Command object at 0x102435110>>
Traceback (most recent call last):
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
    self.validate(display_num_errors=True)
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/core/management/base.py", line 249, in validate
    num_errors = get_validation_errors(s, app)
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
    for (app_name, error) in get_app_errors().items():
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/db/models/loading.py", line 146, in get_app_errors
    self._populate()
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/db/models/loading.py", line 61, in _populate
    self.load_app(app_name, True)
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in load_app
    models = import_module('.models', app_name)
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/Users/nateaune/Dropbox/code/mediathread/djangosherd/models.py", line 223, in <module>
    class SherdNote(Annotation):
  File "/Users/nateaune/Dropbox/code/mediathread/djangosherd/models.py", line 227, in SherdNote
    asset = models.ForeignKey(Asset, related_name="sherdnote_set")
  File "/Users/nateaune/Dropbox/code/venvs/mediathread/lib/python2.7/site-packages/django/db/models/fields/related.py", line 822, in __init__
    assert isinstance(to, basestring), "%s(%r) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string %r" % (self.__class__.__name__, to, RECURSIVE_RELATIONSHIP_CONSTANT)
AssertionError: ForeignKey(None) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string 'self'

natea avatar Mar 18 '13 21:03 natea

Hi Nate -

Have you resolved this one yet?

Jonah had asked -- are you using postgres or sqllite? Have you run ./manage.py migrate?

I'd add -- have you seen this error before? Have you bookmark'd or manually added any assets to the system recently?

Cheers, Susan

ccnmtl avatar Mar 20 '13 16:03 ccnmtl

It was a user error.

natea avatar Mar 24 '13 19:03 natea

shoot, i'm having this problem, and was hoping to find answer on google, brought me here :P However, this user doesn't know what he's doing wrong.

plumtree87 avatar May 24 '21 22:05 plumtree87

I have got same problem this is related to user. Have you solved it?

Anisha12311 avatar Jul 02 '21 04:07 Anisha12311

same problem here :(

FloYanez avatar Oct 13 '21 21:10 FloYanez

Good morning @FloYanez and the others on the thread - I'm sorry to hear you're experiencing issues. Can you give me more information on the issue you're experiencing. Where are you in the installation process?

sdreher avatar Oct 14 '21 13:10 sdreher