Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
natea opened this issue Mar 18, 2013 · 6 comments

Comments

@natea
Copy link

natea commented Mar 18, 2013

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'
@ccnmtl
Copy link
Collaborator

ccnmtl commented Mar 20, 2013

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

@natea
Copy link
Author

natea commented Mar 24, 2013

It was a user error.

@natea natea closed this as completed Mar 24, 2013
@plumtree87
Copy link

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.

@Anisha12311
Copy link

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

@FloYanez
Copy link

same problem here :(

@sdreher
Copy link
Contributor

sdreher commented Oct 14, 2021

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 sdreher reopened this Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants