Skip to content Skip to sidebar Skip to footer

Django Typeerror: Model Instances Without Primary Key Value Are Unhashable

I have my models.py as follows: class Article(models.Model): date = models.DateTimeField(null=True, blank=True) title = models.TextField(default=None, null=True, blank=True

Solution 1:

Try saving it this way -

    art = Article.objects.create(date=publish_date,
                                title=article.title, 
                                content=article.text, 
                                author=article.authors,
                                url=url)

    Keyword.objects.create(word=keywords, article=art)

Post a Comment for "Django Typeerror: Model Instances Without Primary Key Value Are Unhashable"