Skip to content

Section utils

section.utils#

get_or_create_song(artist='', name='') #

Retrieve an extisting song or create a new one

Source code in section/utils.py
def get_or_create_song(artist='', name=''):
    """Retrieve an extisting song or create a new one"""
    from .models import Song
    song, created = Song.objects.get_or_create(
        artist=artist,
        name=name)
    return song