4b11b4 / potify

[S]potify generic music player learning project
0 stars 1 forks source link

SongManager methods #4

Open 4b11b4 opened 5 years ago

4b11b4 commented 5 years ago

I am attempting to create the first manager method which will: return the set of all songs, filtered by: artist, album, (then?) playlist

note: when we defined our song model, we decided that a song could have multiple artists, and multiple album

Here are four places I could use your help:

  1. I am not sure of the function return data type: a list?

  2. The code I have written closely follows the PollManager example from: https://docs.djangoproject.com/en/2.1/topics/db/managers/#custom-managers

  3. SQL query:

    • (I could get in depth with SQL queries now, but maybe it would speed my learning if you did this one as a simple example)
    • I guessed. Tried to at least line it up with our song model definitions.
    • unclear: the variable in the query, "s", is defined on the FROM line?
    • unclear: both variables on the FROM line
    • unclear: the "DESC" keyword at the end
  4. SongManager instantiation inside Model definition: in "song-manager" branch, potify/music/models.py line 49

    • Let's see if the comments in the code explain enough?
4b11b4 commented 5 years ago

this code is on the song-manager branch

zachcalvert commented 5 years ago

Woah, that example rom the docs surprises me. I don't like to have raw SQL, full-stop, in any of my Django projects. Sometimes it's unavoidable, but fortunately I think for our use case here we don't need any SQL.

I also may have suggested this prematurely, we may not need a custom manager/queryset at all. Let's look at this together next time we meet and see if it helps us.

4b11b4 commented 5 years ago

For now the song-manager branch will sit.