Filter SearchResults by title only for uniqueness

This commit is contained in:
Keannu Bernasol 2024-10-31 00:44:25 +08:00
parent 1c20a68cb0
commit c567582124

View file

@ -7,7 +7,7 @@ from .models import SearchResult
autoretry_for=(Exception,), retry_kwargs={"max_retries": 0, "countdown": 5}
)
def create_search_result(title, link):
if SearchResult.objects.filter(title=title, link=link).exists():
if SearchResult.objects.filter(title=title).exists():
return "SearchResult entry already exists"
else:
SearchResult.objects.create(title=title, link=link)