DEV Community

Discussion on: Django Same data objects get created every time!

Collapse
 
j_mplourde profile image
Jean-Michel Plourde

Each time the code is loaded, the create function is called but there is nothing to prevent duplicates. For a web scraper, it's a good idea to create a cool down feature with an off-switch for debugging.

 for i in range(len(iitg_title)):
        News.objects.create(title = iitg_title[i], datess = iitg_date[i], linkss = iitg_link[i])
Enter fullscreen mode Exit fullscreen mode