mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-16 19:59:24 +08:00
Filter SearchResults by title only for uniqueness
This commit is contained in:
parent
1c20a68cb0
commit
c567582124
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue