Django Tutorial for Beginners - 17 - Adding Songs to our Database

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

boy I so love the way you teaching! you are such a great teaching material

guoguowg
Автор

Wow This tutorial is new! Im using django right now. Im impressed

GeneBoyAcheche
Автор

Quick Tip for Django in PyCharm:
You can run manage.py task under VSC or with rightclick on manage.py.

gniludio
Автор

Thanks for explaining why we don't need to migrate after making the simple change. I was a bit confused.

RamisaAnjum
Автор

Django tutorial 17 Adding Songs to our Database
apps used in this tutorial

\music\admin .py
\music\models .py

consumerdude
Автор

A tip for anyone who is adding an integer field and an unicode field.
Make sure to change:
def __str__(self):

into:

def __buffer__(self):

calebwhite
Автор

Changing the data of song_title from I hate my boyfriend to I love my boyfriend was damn funny to hear. haha lol

shreejanshrestha
Автор

Nice one Bucky the awesome. Let's say I've got a yuge list of songs let's say 50k rows on my PC in csv format, how tha heck can I add those to my admin/database via PowerShell?

donpislik
Автор

Hello! I was curious to try "on_delete=models.CASCADE" and I don't know how or if it is possible to delete an album from command prompt. Can anyone please help?

cidetoo
Автор

-- Songs not showing --

If your songs aren't showing in the admin page after following the first part of the tutorial with no errors then they won't show until you start creating Song objects for the admin panel to show.

So do everything in the tutorial first and see if it works at the end

MCDAYZ
Автор

Why are you using shell if could easily add the data throw the admin interface?

MohamedAyman-lirp
Автор

Dear Bucky, please help me solve this .
>>> album1.artist()
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: 'unicode' object is not callable
>>>

TIA,
Shreeram

shreerampattanayak
Автор

Hi Punk! Great videos!!

However I have on little question which I am stuck with. You are using the term album and Album, (with or without a CAPITAL letter. When do you use which? Is album automatically created from class Album? Thanks for the vids! Best arround, and I spend a few days googling arround.

Thank U

michielhuis
Автор

im getting a error when im trying to display the songs i guess there is something wrong with
def __str__(self):
return self.file_type
in shell when i try
>>> song
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Users\Ashiq\AppData\Local\Programs\Python\Python37\lib\site-packages\django-2.1-py3.7.egg\django\db\models\base.py", line 502, in __repr__
return '<%s: %s>' % (self.__class__.__name__, self)
File "D:\Django_projects\website\music\models.py", line 21, in __str__
return self.file_type
TypeError: unsupported operand type(s) for +: 'Album' and 'str'


any fix? or y this is occouring

aadilmohammad
Автор

I am having a problem "except Album.DoesNotExist:" here why we used capital lettered Album? Please help anyone

rezoannazib
Автор

When I tried registering Song in admin, and went to localhost:8000/admin/

I got following error : 'set' object is not reversible.

Kindly suggest what to do.

shaileshsharma
Автор

not able to execute 10-11 line ? what to do

manilmalhotra
Автор

when I go into back into the website after adding a song it says: coercing to Unicode: need string or buffer, Album found

any fix?

liordah
Автор

Okay, can anyone explain this? When I create a variable that assigns to the model Album, and save the value, everything works fine and it saves the data in admin. However, when I save a variable that is assigned to Song model with nothing in parameters, the save fails.

gallegom
Автор

I accidentally entered:
song.album_title = 'I hate my boyfriend'
instead of:
song.song_title = 'I hate my boyfriend'
and saved it.
I don't see any problems caused by the improper name, but should it be deleted. Since it did
not match anything in the models attributes, was it still saved in the database? How would
I delete the entry?

tonyiguru