Datafable/epu-index

Make sure articles are unique

Closed this issue · 6 comments

  • Option 1: Set a unique constraint on the articles url. Problem: articles scraped before 2013 don't have a url. (see also #53)
  • Option 2: Set a unique constraint on a combination of the fields news_journal, published_at and title

Urls are not an option (see #53 ) so we'll have to go for option 2.

@niconoe can we add such a constraint in the models file?

Yes, it can be implemented using unique_together, and Django will create constraint at the database level. Does that looks good?

Excellent!

Since URLs are still mandatory, I cannot test if articles without URL are displayed nicely on the front end. Don't close this issue until this has been tested.

The URL is now optional, and unique_together constraint is set (everything deployed to Heroku). I guess this issue + #53 + #63 are now solved, please test!

Frontend works: only shows newspaper name, without link if no URL is available.