[Fixed]-ForeignKey. "Is an invalid keyword argument for this function"

1👍

Instead of category = models.ForeignKey('Category', name='catégorie')

Use category = models.ForeignKey(Category, name='catégorie')

And when creating the card try:

category = Category.objects.get(id=form.cleaned_data['category'])
card = Card(link=link, vigil=request.user.profile, category=category)

Also make sure you correct your model-order: First define the Category-, then the Card model.

When you’ve done this, replace name=... in your model with verbose_name=...

Hope this helps 😀

Leave a comment