AssertionError: ForeignKey(None) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string 'self'
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'
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
It was a user error.
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.
I have got same problem this is related to user. Have you solved it?
same problem here :(
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?