[Answer]-Django DateTimeField User Input

1πŸ‘

βœ…

The issue is that you do not pass to Article.objects.get_or_create the data needed to create a new object in case none already exists.

What you need to do is (see the documentation for get_or_create):

article = Article.objects.get_or_create(
    article_title=article_title,
    pub_date=pub_date,
    defaults={
        'id': id,
        'article_keywords': article_keywords,
        # etc...
    }
)[0]

The data passed using the defaults argument will only be used to create a new object. The data passed using other keyword arguments will be used to check if an existing object matches in the database.

πŸ‘€aumo

Leave a comment