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
 9
10
11
12
13
14
15
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