Django Tutorial for Beginners – 7 – Creating Models

Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –






38 responses to “Django Tutorial for Beginners – 7 – Creating Models”

  1. Ethan Axline Avatar

    Thanks again bucky! HOSS!

  2. Sujit Joshi Avatar

    Why is album logo a char field?

  3. Oliver Koo Avatar

    how long are people's name? ughhhh 250? lol

  4. red cat Avatar

    I have a weird feeling that your tutorials aren't going anywhere. I am still open with a terminal and an ide and did nothing useful despite being the 7th video.

  5. Yo Co Avatar

    if you have a varchar is the same charfield variable to be used?

  6. Michael Kaplan Avatar

    Hey Bucky, great videos! What if I want to have a song that is not included in an album? does this form of data base supports that?

  7. Felipe Uchoa Avatar

    Dude, I got a little confused at one thing. If I create an app for login, I will have to create my user model, right? But if I want to use this user information in another app, will I have to redo the same model again? Can the information contained in the model of an app be accessed by all apps in the application?

  8. Himanshu Panth Avatar

    How to put images in the model?

  9. Ageu Matheus Avatar

    The way you explain is very good. Short and objective. Just fine, thank you dude!

  10. Kratos Avatar

    any good book for django that will go well with
    the videos

  11. Shanur Rahman Avatar

    For anyone having trouble you may use this

    from _future_ import unicode_literals

    from django.db import models

    # Create your models here.
    # blue print of how we are going to be using our database
    # every class you create here will be converted into columns in database

    class Album(models.Model): #every class inherits from models.models
    artist = models.CharField(max_length=250)
    album_title = models.CharField(max_length=500)
    genre = models.CharField(max_length=100)
    album_logo = models.CharField(max_length=1000)

    class Song(models.Model):
    # A song needs to be a part of an album
    album = models.ForeignKey(Album, on_delete=models.CASCADE)
    file_type = models.CharField(max_length=10)
    song_title = models.CharField(max_length=250)

  12. Parvat Bishwakarma Avatar

    Just a quick question. When you create a class in file, does it create a separate table for you in the database? Thanks.


    Man you are awesome !!!! Thank you very much for these amazing tutorials.

  14. Ram Mohan Avatar

    hi, pls correct my understanding, at 8:55, Foreign key is not specified anywhere to use in "album" , so by default it will picked the unique id as foreign key is it right??

  15. Thomas Hodges Avatar

    My default models imports unicode_literals from _future_. pyMongo asked me if I wanted to enable some compatibility testing service.
    I know that typing python on my system defaults to version 2.7.12 where python3 defaults to 3.5.2. I think that I have been typing python instead of python3 for some of these steps. Will that make a difference?

  16. Subramanian Sridharan Avatar

    You can use URLField instead of CharField for the album_logo URL right? 🙂

  17. Imad Kalboneh Avatar

    Hey man. I've been following your videos and have been learning a lot! 🙂 Thank you! Here's a tip though. Instead of copying and pasting a line, you can just put your cursor anywhere on the line you wanna copy, hold Ctrl and press D. It'll duplicate the line right under it. Same goes with Notepad++ .

  18. kampkrieger Avatar

    ??? what are you doing??

  19. JonesNanaz Avatar

    Wow! django beast for me is turning into its pony nature with your nice tutorials.

  20. pawan singh Avatar

    Great tutorials…
    Just getting confused how could we categorise books, viz. one book could fall under two or may be more groups like a book on public finance could be grouped under Finance as well as Public Administration.

  21. rajeshkhan808 Avatar

    Great tutorial . I cant find the soruce code to this on your gitHub repo ?

  22. lovish Goyal Avatar

    i like the way u did aaaaaaaaaaaaahhhhhhhhhhhhh………….. great sir huge respect for your tutorials

  23. Aayush Kumar Avatar

    Dude.. Taylor Swift??? seriously?

  24. Crow Go Avatar

    This is 500 characters. What album has 500 characters?

    Khan The Main Dog of The Century The Divine Tale of Tails of The Company Telltale, Inc Don't Tattle Tale and Understand Main Dog of The Century, a Divine Tale of Tails of the Company Telltale. Khan The Main Dog of The Century The Divine Tale of Tails of The Company Telltale, Inc Don't Tattle Tale and Understand Main Dog of The Century, a Divine Tale of Tails of the Company Telltale.Khan The Main Dog of The Century The Divine Tale of Tails of The Company Telltale, Inc Don't Tattle Tale. TheHell

  25. Solmaz Hezarkhani Avatar

    I created the music directory, but I don't have

  26. Ryan Radloff Avatar

    i also have this @ the top of my scripts: from _future_ import unicode_literals and i noticed you dont

  27. Ryan Radloff Avatar

    I keep getting this error when i runserver any ideas what to do?:

    Unhandled exception in thread started by <function wrapper at 0x10ec57aa0>
    Traceback (most recent call last):
    File "/Library/Python/2.7/site-packages/Django-1.10b1-py2.7.egg/django/utils/", line 226, in wrapper
    fn(*args, **kwargs)

  28. Shadman Faysal Avatar

    I have face ,,,,, "App 'music' could not be found. Is it in INSTALLED_APPS?"

    this error when i in terminal i press enter after writting this line ,, "python makemigrations music"
    what should to do ?

  29. Shengheng GAO Avatar

    taylor swift's song : hey my boyfriend. LOL 😀

  30. Halgurd Aziz Avatar

    since few months, I am just trying to get the idea how to learn Django, but no chance until I found this tutorial………… thank you

  31. californication Avatar

    Bucky, i was wondering how can i crate an array field ? For example if i have class team and i want to store players in field players. Is the models.ManyToManyField(Player) a solutution ?

  32. ErichLancaster Avatar

    Bucky, you shouldn't prepend class member fields with the class name. You'll end up with redundancies like album.album_title instead of album.title. Plus it's inconsistent because title is album_title but artist is just artist.

  33. A plant Avatar

    Will you cover working with intersection tables in this series?

Leave a Reply

Your email address will not be published. Required fields are marked *