[Fixed]-Django queryset – get created object from database and equal the values

1👍

To check if the data is already in database, you could first query on News model with the data submitted from the form and check if database returns any result, like:

matching_objects = News.objects.filter(title="SomeText")
# this means the query returned at least one result
self.assertNotEqual(matching_objects.count(), 0)

Leave a comment