Skip to content

Commit

Permalink
Replace track create with get_or_create
Browse files Browse the repository at this point in the history
  • Loading branch information
Alschn committed Nov 22, 2023
1 parent 105fe49 commit 95bf397
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tracks/spotify/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def create_records_from_metadata(link_id: int, metadata: dict) -> Track:
}
)

track = Track.objects.create(
track, _ = Track.objects.get_or_create(
name=metadata['name'],
author=author,
meta=metadata,
defaults={
'meta': metadata,
}
)

try:
Expand Down

0 comments on commit 95bf397

Please sign in to comment.