python manage.py shell
from music.models import Album, Song
>>> a = Album(artist='Taylor Swift', album_title='Red', genre='Country', album_logo='https://www.google.com/imgres?imgur
l=https%3A%2F%2Ff4.bcbits.com%2Fimg%2F0012335631_10.jpg&imgrefurl=https%3A%2F%2Ftunes.mamabirdrecordingco.com%2Falbum%2F
i-need-to-start-a-garden&docid=D9UBJ_P_Bkn6RM&tbnid=82ronHe4dPoZtM%3A&vet=10ahUKEwiVm7XLjdrgAhXLqZ4KHbPUBDUQMwiMASgVMBU.
.i&w=1200&h=900&bih=583&biw=971&q=album&ved=0ahUKEwiVm7XLjdrgAhXLqZ4KHbPUBDUQMwiMASgVMBU&iact=mrc&uact=8')
>>> Album.objects.all()
<QuerySet []>
>>> a.save()
>>> Album.objects.all()
<QuerySet [<Album: Album object (1)>]>
>>> a.artist
'Taylor Swift'
>>> a.album_title
'Red'
>>> a.id
1
>>>
---------------------------
>>> b = Album()
>>> b.artist = 'Myth'
>>> b.album_title = 'High School'
>>> b.genre = 'punk'
>>> b.album_logo = 'https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.graphistudio.com%2Fwp-content%2Fuploads%2F201
8%2F01%2Fluce_up.png&imgrefurl=https%3A%2F%2Fwww.graphistudio.com%2Fen%2Fthe-digital-matted-album%2F&docid=XWMXDGCi9Ureh
M&tbnid=qJPwFHsm06zxDM%3A&vet=10ahUKEwiVm7XLjdrgAhXLqZ4KHbPUBDUQMwiOASgXMBc..i&w=956&h=764&bih=583&biw=971&q=album&ved=0
ahUKEwiVm7XLjdrgAhXLqZ4KHbPUBDUQMwiOASgXMBc&iact=mrc&uact=8'
>>> b.save()
>>> b.album_logo
'https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.graphistudio.com%2Fwp-content%2Fuploads%2F2018%2F01%2Fluce_up.pn
g&imgrefurl=https%3A%2F%2Fwww.graphistudio.com%2Fen%2Fthe-digital-matted-album%2F&docid=XWMXDGCi9UrehM&tbnid=qJPwFHsm06z
xDM%3A&vet=10ahUKEwiVm7XLjdrgAhXLqZ4KHbPUBDUQMwiOASgXMBc..i&w=956&h=764&bih=583&biw=971&q=album&ved=0ahUKEwiVm7XLjdrgAhX
LqZ4KHbPUBDUQMwiOASgXMBc&iact=mrc&uact=8'
>>>
No comments:
Post a Comment