Django Tutorial for Beginners - 30 - Model Forms

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ม.ค. 2025

ความคิดเห็น • 145

  • @Arximed1Monte
    @Arximed1Monte 8 ปีที่แล้ว +72

    If anyone stuck, because of the changed design, compare your files to files in this repository:
    github.com/monteua/viberr
    I think, all the new code, which was not showed you can find here.

    • @shaneodonnell2515
      @shaneodonnell2515 8 ปีที่แล้ว

      Thank you, this got me back on track

    • @ggodoyoliveira
      @ggodoyoliveira 8 ปีที่แล้ว

      Thanks man!

    • @aladolfsenjustanoldguy2045
      @aladolfsenjustanoldguy2045 8 ปีที่แล้ว +3

      Many thanks. I didn't know that knowledge of Bootstrap was required. You help me quite a bit. Arrogant of Bucky to assume and not provide requirements before starting.

    • @davcastroruiz
      @davcastroruiz 8 ปีที่แล้ว

      thanks!

    • @amirshahnazar6674
      @amirshahnazar6674 8 ปีที่แล้ว

      thanks man

  • @brodWenDayondon
    @brodWenDayondon 7 ปีที่แล้ว +12

    Ok. Before you start the tutorials make sure you already changed the templates index.html, details.html, and the base.html. I'm using Bootstrap 4
    {% extends 'music/base.html' %} {% block body %}
    {% for album in all_albums %}


    {{ album.title }}
    {{ album.artist }}
    View Details



    {% endfor %}
    {% endblock %}
    {% load staticfiles %}

    {% block title %} Viberr {% endblock %}
    Viberr


    Albums
    (current)


    Songs


    Search


    Add Album

    Log-out

    {% block body %}
    {% endblock %}



    {% extends 'music/base.html' %} {% block title %} Album Details {% endblock %} {% block body %}


    {{ album.artist }} | {{ album.title }}
    {{ album.brief_description }}

    All Songs




    Title
    Audio File
    Favorite
    Actions

    {% for song in album.song_set.all %}
    {{ song.title }}
    .{{ song.file_type }}
    {% if song.is_favorite %}
    {% endif %}





    {% endfor%}


    {% endblock %}

    • @Crucizer
      @Crucizer 5 ปีที่แล้ว

      you're a kind person

    • @KC_Nasci
      @KC_Nasci 3 ปีที่แล้ว

      You're the king man. Thank you

  • @retkoussa
    @retkoussa 6 ปีที่แล้ว +7

    If you're watching in 2018:
    Note that:
    - from django.core.urlresolvers import reverse
    should now be ->
    - from django.urls import reverse

  • @MaverickQbiak
    @MaverickQbiak 5 ปีที่แล้ว +2

    I actually appreciate how it's all combined - Django, css, html and bootstrap - but that's because I don't know any of that! Great videos!

  • @sean123654
    @sean123654 8 ปีที่แล้ว +52

    I knew this day was coming......the day I have to go and learn bootstrap! lol

    • @SireBandi
      @SireBandi 8 ปีที่แล้ว +1

      +Ricky Singh It's not a waste of time! Put some effort into learning bootstrap and it'll pay off with interest in no time!

    • @cesarochoa5593
      @cesarochoa5593 7 ปีที่แล้ว +1

      A thing that i used to do is just write all code on my own style and then tranform it keeping classes and ids to bootstrap styling.

  • @weho_brian
    @weho_brian 7 ปีที่แล้ว +5

    for those who are stuck, this is what you can try. goto his github, copy the code for the index.html and detail.html in your files. When you try to re-run your site you will get some errors. All you do is delete the references to the views or functions that don't yet exists. Foe example, just set href= "", this will just set it to dead links for the time being.

    • @ded-pihto
      @ded-pihto 7 ปีที่แล้ว

      Thx, that's work.

  • @jyothishkumar3098
    @jyothishkumar3098 7 ปีที่แล้ว +30

    that awkward moment when you have watched 30 tutorials and still don't understand django.

    • @adrianzyskowski1989
      @adrianzyskowski1989 7 ปีที่แล้ว +5

      tell me if you had understood it now after 8 months

    • @vaibhavtiwari6992
      @vaibhavtiwari6992 4 ปีที่แล้ว +2

      Now?
      3 years?

    • @jyothishkumar3098
      @jyothishkumar3098 4 ปีที่แล้ว +1

      @@adrianzyskowski1989 This was my brother's account 😁 I remember seeing him build this project back then (and he was 15). He's focused on high school and college entrance exams and now but I think he gottor a better idea of the topic.

    • @jyothishkumar3098
      @jyothishkumar3098 4 ปีที่แล้ว

      @@vaibhavtiwari6992 👆😁

  • @ahmedtevez
    @ahmedtevez 6 ปีที่แล้ว +8

    If you are working with Django 2.0. its now "from django.urls import reverse" instead of "django.core.urlresolvers import reverse".

    • @dukesanmi4999
      @dukesanmi4999 5 ปีที่แล้ว

      No other changes to the code?

  • @pascallohscheidt7281
    @pascallohscheidt7281 7 ปีที่แล้ว

    Thanks, Bucky :) a clean tut as always. :) For all people complaining about this Bootstrap thing. This is a tutorial about Back-End-Development. No Front-End-Design. There are thousands of videos for bootstrap.

  • @tanetsriamorn3021
    @tanetsriamorn3021 7 ปีที่แล้ว +13

    ** DYI **
    Django 2.0 removes the django.core.urlresolvers module, which was moved to django.urls in version 1.9. You should change any import to use django.urls instead.

  • @swarlos99
    @swarlos99 8 ปีที่แล้ว +6

    c'mon dude not all of us know bootstrap too well despite watching your tutorials on it

  • @Hackaprende
    @Hackaprende 7 ปีที่แล้ว

    Pausing this tutorial to take the bootstrap one, a new challenge!

  • @Athomield3D
    @Athomield3D 8 ปีที่แล้ว +51

    making html/css modifications off-screen is not cool mate, it confuses ppl

    • @RossDCurrie
      @RossDCurrie 8 ปีที่แล้ว +6

      Yeah, it wouldn't be as big of an issue if he at least included a version on github for "Start of Tutorial 30". Right now I'm picking apart what's there to try and bring it back to where it was at the start of the tutorial.

  • @karandave4481
    @karandave4481 7 ปีที่แล้ว

    reverse can be imported from django.urls instead of django.core.urlresolvers for those finding reference errors. It worked for me.

  • @carstenht
    @carstenht 8 ปีที่แล้ว +20

    It might be that people should know bootstrap but i didnt and was following the tutorial step by step to learn by typing. And this was kinda off-setting to suddenly have to and download a bunch of code you havent been walked through. This might not sound like a big thing, but when you are learning something from scratch, taking things step by step is the way to go in terms of teaching. So, if Bootstrap was a prerequisite, it should have been mentioned earlier. You had it going good up until this point teaching wise.

    • @cesarochoa5593
      @cesarochoa5593 7 ปีที่แล้ว

      You can learn so fast bootstrap thing so easy, just google 'bootstrap w3 schools' and go for the first result. There is a lot and complete bootstrap functions tutorial there.

  • @davogrady
    @davogrady 8 ปีที่แล้ว

    I have a question. On 4:53 you import CreateView, UpdateView and Deleteview from django.views.generic.edit. Wouldn't they have been imported from line 1 "from django.views import generic" ?

    • @mitchjohnson4714
      @mitchjohnson4714 7 ปีที่แล้ว

      I'm not an expert, but I think he could have said (generic.edit.CreateView) below, without having to import those classes. I think he just thought it would look a little nice to import those classes above and then write (CreateView) below.

  • @bhawnakukreja7589
    @bhawnakukreja7589 8 ปีที่แล้ว +5

    plz upload the video on the design part of this video:-)...we really need it Bucky Sir....

  • @Deeredman4
    @Deeredman4 6 ปีที่แล้ว +4

    Bucky... Typically; I love your videos, I have been watching them since I was a kid, I have learned a lot from them, they are very informative, detailed, and of the highest quality but in this case; you have left out a HUGE chunk of essential information... I can understand not explaining all of it but you really should at least show it on camera so that we can copy it. I am honestly, and unfortunately; a little disappointed over this one.
    I know that people are going to say "Well, it's a free tutorial so; you can't complain." and while I appreciate the effort; keep in mind that because I cannot follow the tutorial from this point forward; you just wasted hours (over the course of 2-3 days) of my time and since I still don't understand Django; I have to go watch someone else's videos and spend even more time covering the basics (which I already spent the last 2-3 days learning) all over again.
    I just wanted you to know exactly what you are doing to people with this tutorial so that you could understand why you need to do something about it. I recommend that you please either redo this video or take down the entire series so that this doesn't happen to the next guy that comes along. At the VERY least you could put an annotation in the first video that says "Knowledge of bootstrap is REQUIRED for this tutorial series; you have been warned." In the first video you mention that it is used and that you won't be explaining it, and that is fine but; you never specifically say "I am going to leave chunks of code off camera so; you will need to know bootstrap to follow along."
    I am tempted to skip ahead and try to piece together the file from future videos to try to recover the time that I have lost but I am leery because I don't know whether or not you are going to do this again on video 36 or video 37... I'm going to take a break while I decide how to approach this moving forward...
    EDIT: After perusing the comments I found a comment by Vadym Stavskyi that puts the missing code in a github repo: github.com/monteua/viberr I believe it might be more full featured than the code you have at this point in the tutorial but it's better than nothing. Could I recommend that you please put this link in the video description and/or an annotation in the video?

  • @davidgromer2117
    @davidgromer2117 6 ปีที่แล้ว

    Nice vid ,but I have a question. How could i create a Instance of "Song" with a further Attribute (let's say "song_publisher) and set this Attribute via ForeignKey equal to the user who is currently logged in.

  • @eshanmehendal2481
    @eshanmehendal2481 6 ปีที่แล้ว

    to do the grid view like bucky did in this video do this -


    Thumbnail label
    ...
    Button Button

  • @mitchjohnson4714
    @mitchjohnson4714 7 ปีที่แล้ว +1

    Should there be a caret in that regular expression at the end?

    • @tonyiguru7595
      @tonyiguru7595 4 ปีที่แล้ว

      It seems to work with or without the caret, so I left mine in there:
      re_path(r'^album/add/$', views.AlbumCreate.as_view(), name='album_add'),

  • @addohm
    @addohm 8 ปีที่แล้ว +1

    I used the following -
    def get_absolute_url(self):
    return reverse('music:album_detail', args=[str(self.id)])

  • @didi2500
    @didi2500 6 ปีที่แล้ว

    I'm so happy that many people don't know bootstrap like me. I thought I was the only one who doesn't know it. haha!

  • @varunreddy3865
    @varunreddy3865 5 ปีที่แล้ว

    I only have a small doubt, I understood up to submit button but what I can't understand is how is data saved directly in the DATA BASE even though we didn't write any functionality?

  • @devchahal4917
    @devchahal4917 5 ปีที่แล้ว

    can anyone tell when bucky refered to music:detail in reverse was he reffering to the detail html file or the name in urls where he has specified name='detail'

  • @omarFaruk-hu4ig
    @omarFaruk-hu4ig 6 ปีที่แล้ว +1

    why from django.core.ultresolvers import reverse does don work, when i import it gives wrong

    • @tushardm1729
      @tushardm1729 6 ปีที่แล้ว +1

      use from "django.urls import reverse"

  • @christianlisangola9383
    @christianlisangola9383 7 ปีที่แล้ว

    when i try to import reverse in my models.py file with the following line:< from django.core.urlresolvers import reverse> i'm getting this error :

  • @yuvaraj9740
    @yuvaraj9740 5 ปีที่แล้ว +1

    " from django.urls import reverse" if you got a error in importing urlresolvers!

  • @user47263
    @user47263 7 ปีที่แล้ว

    Hi Bucky! How to add new songs using the link on the detail view?

  • @Robert-jl2tl
    @Robert-jl2tl 4 ปีที่แล้ว

    I wish there were an easy way to see a list of all of these Django videos in order so it was easier to watch them all. Doing a search on YT brings back a mish-mash of links.

  • @donpislik7709
    @donpislik7709 7 ปีที่แล้ว

    NEED HELP: Reverse for 'detail' with arguments '()' and keyword arguments '{'pk': 19}' not found. 0 pattern(s) tried: []

  • @ishwaraju
    @ishwaraju 8 ปีที่แล้ว

    hello bucky can u please provide the link of the code which u have used to create the website design.. please i m a beginer. i was learning following each and every step and the sudden chaneg really confing me . please help me..
    please do provide the code. thanks in andvance

    • @manishadwani386
      @manishadwani386 8 ปีที่แล้ว +2

      go to github Bucky Roberts viberr

  • @m.haroonali4214
    @m.haroonali4214 4 ปีที่แล้ว

    i cant get your project on github plz give me link of the code in github

  • @Crucizer
    @Crucizer 5 ปีที่แล้ว +1

    if anybody knows how to make that bootstrap fancy thing, please kindly share the code.

  • @semirumutkurt6635
    @semirumutkurt6635 8 ปีที่แล้ว +4

    github.com/sumut/ahrazify don't forget to give stars .__. just kidding. here is the design change between video tutorials 29 and 30
    IMPORTANT EDIT: do not forget to download favicon where located under /music/static/ and main.js where located /music/static/music/js/main.js

    • @semirumutkurt6635
      @semirumutkurt6635 8 ปีที่แล้ว

      I named the project ahrazify. it's ironic name, i was bored when i named it. ahraz means deaf in arabic

    • @davcastroruiz
      @davcastroruiz 8 ปีที่แล้ว

      Thanks!

    • @semirumutkurt6635
      @semirumutkurt6635 8 ปีที่แล้ว +1

      i will upload detail page this night. yesterday there was match between bayern and arsenal. thats why I couldn't complete

    • @davcastroruiz
      @davcastroruiz 8 ปีที่แล้ว +1

      gist.github.com/davcastroruiz/a3d4267982b2476236a8665459122337
      Here you have, I add an Update button for tutorial 32

    • @jyothishkumar3098
      @jyothishkumar3098 7 ปีที่แล้ว

      Thanks man!

  • @Khan_2025
    @Khan_2025 6 ปีที่แล้ว

    'music:views' is not a viewname, how can i fix it

  • @manishadwani386
    @manishadwani386 8 ปีที่แล้ว

    how can I create that list view where all songs are listed. it's weird to make that table view
    if anyone has a tutorial link please replay

  • @lawfirm7279
    @lawfirm7279 8 ปีที่แล้ว +9

    Bro this is not cool.If you want to prof ,do not prof with assumptions .Now i fine it out hard to follow up with your tutorial

  • @muntadarmuhammad4578
    @muntadarmuhammad4578 6 ปีที่แล้ว

    the hard part is coming
    why is the point from get_absolute_url function can some one explain plz

  • @sagarkumar0711
    @sagarkumar0711 6 ปีที่แล้ว

    I am not getting the images in the index and details pages, except this everything is working as expected. So someone help me out please.

    • @ozzyparkar8405
      @ozzyparkar8405 5 ปีที่แล้ว

      Did you find out what was wrong? Im getting the same error but only for the Index Page

  • @bidhanmondal4032
    @bidhanmondal4032 8 ปีที่แล้ว

    hey bucky can you say how to see the total list that is coming through object_list?? not just like object_list.title and all. i want to see all the data at once like print(object_list) will do in python. can you help?? or anyone?

    • @lingovilla
      @lingovilla 8 ปีที่แล้ว

      you just have to write, name_of_class.object.all() that returns all the data from the database.

  • @Robert-jl2tl
    @Robert-jl2tl 4 ปีที่แล้ว

    It would also be really helpful if all of this code he's writing were in a repository we could pull. I followed the GitHub link above and couldn't find anything pertaining to this video.

  • @muhammadtariq7474
    @muhammadtariq7474 6 ปีที่แล้ว

    its great to follow your taturiols online

  • @ani2595
    @ani2595 6 ปีที่แล้ว +1

    Did anyone get a NoReverseMatch error?

  • @atharva-naik
    @atharva-naik 4 ปีที่แล้ว

    There is a big flaw here, if I know bootstrap I can skip bootstrap parts, but if I don't then that is another tutorial series for me

  • @avinashanand8994
    @avinashanand8994 8 ปีที่แล้ว

    can anyone please share or point out where can i find the code for the above bootstrap styling

  • @PersephonesVoice
    @PersephonesVoice 7 ปีที่แล้ว

    I imported the project "as-is" from github, unpacked, ran, failed. Went in, modified the first issue, failing again, this time with:WSGIRequest' object has no attribute 'user'
    At this point, I cant continue the tutorials.
    I dont know whats wrong with my previous code, I dont know whats wrong with your code, and I dont have the knowledge to fix it, because I cant follow along in the code, because my code doesnt match your code, and my code and your code doesnt work.
    All in all, it was a beautiful Casey Jones.

  • @jhunyormonttez7408
    @jhunyormonttez7408 8 ปีที่แล้ว

    mmm im lost , what should i do now? pffff copy the entire code on github? but, that way i cant understand anything......

  • @RohitChaurasiyalisten
    @RohitChaurasiyalisten 5 ปีที่แล้ว

    in view y u making class actually according to my reading in view.py only functaion and return type that is standard #buckyroberts correct me if i am wrong.

  • @melvyniandrag
    @melvyniandrag 8 ปีที่แล้ว +1

    The CreateView is different from the other views we've seen so far I think because the template it fills in isnt mentioned explicity in the class, right? The docs docs.djangoproject.com/en/1.10/ref/class-based-views/generic-editing/ say:
    The CreateView page displayed to a GET request uses a
    template_name_suffix of '_form'. For
    example, changing this attribute to '_create_form' for a view
    creating objects for the example Author model would cause the
    default template_name to be 'myapp/author_create_form.html'.
    So that's how the CreateView sees the template it should use. I was confused by this for a few minutes.

  • @self5010
    @self5010 8 ปีที่แล้ว +3

    If anyone lost the track, here the code and compare with yours
    github.com/Ananthu/Django-thenewboston-youTube-classes

  • @dasvas9383
    @dasvas9383 7 ปีที่แล้ว

    Django 2.0 removes the django.core.urlresolvers module, which was moved to django.urls in version 1.9.

  • @augustuscaeser8939
    @augustuscaeser8939 7 ปีที่แล้ว

    also please do a tutorial series on materialize css framework

  • @AbhishekNigam
    @AbhishekNigam 7 ปีที่แล้ว

    Maybe you could've made a skippable video for styling the website using bootstrap

    • @vigneshnc7253
      @vigneshnc7253 7 ปีที่แล้ว

      Yeah. I too noticed that

  • @ArifAli-ps3qr
    @ArifAli-ps3qr 7 ปีที่แล้ว

    i got this
    No module named 'django.core.urlresolvers'
    {% pls help asap %}

    • @ArifAli-ps3qr
      @ArifAli-ps3qr 7 ปีที่แล้ว +1

      i found it------ django.urls import reverse

  • @micoberss5579
    @micoberss5579 7 ปีที่แล้ว

    I didnt get why we need REVERSE function and what it does

    • @mitchjohnson4714
      @mitchjohnson4714 7 ปีที่แล้ว

      I'm not good at django, but I will try to answer this, since nobody else has. Basically, I think the reverse function takes the name of a url (as seen in the urls config file) and returns the actual url. I think it's called "reverse" because normally you'd type in the url, it would then look it up and call the appropriate view. That's sort of the reverse of what he wants to do here.

  • @TheMesoria
    @TheMesoria 7 ปีที่แล้ว

    Well, done tut, I really do not understand this whole "omfg, offscreen!" kind of hate... If you do nto know bootstrap, you just will not use it freely after watching you make bootstrap part. Daever, Like always wonderful ez af tut to understand, ty!

  • @consumerdude
    @consumerdude 6 ปีที่แล้ว

    Django tutorial 30 Model Forms
    apps used in this tutorial
    \music\urls .py
    \music\views .py
    \music\models .py

  • @s.bhargavakrishna8749
    @s.bhargavakrishna8749 7 ปีที่แล้ว

    nice one ...thanks.

  • @mitchjohnson4714
    @mitchjohnson4714 7 ปีที่แล้ว +1

    I wish people would quit whining about bootstrap. If you're building a website along with Bucky, it will still work just the same. It just won't have cool styling. Still, I do think that Bucky should have avoided it.

  • @jarnalyrkar
    @jarnalyrkar 7 ปีที่แล้ว +4

    Aww, your decision to write the design off-screen is really frustrating and a bit off-putting. Everything went smooth to here. Fortunately other people in the comments has supplied the missing code, but as others are commenting, we now do not have any idea of the changes made.. Hope you avoid doing this in the future - keep each playlist seperate, not dependant on eachother.
    Apart from that, i love your casual style of videos, i'm learning a bunch, and for free! So I know i'm not in a position to complain.

  • @hoangyell
    @hoangyell 7 ปีที่แล้ว

    thank you

  • @augustuscaeser8939
    @augustuscaeser8939 7 ปีที่แล้ว +2

    this series sucks please remake this series i get more confused from watching this than learning

  • @aladolfsenjustanoldguy2045
    @aladolfsenjustanoldguy2045 8 ปีที่แล้ว +11

    pretty arrogant having bootstrap as a requirement without telling us at the beginning.

  • @samuelkyama5935
    @samuelkyama5935 7 ปีที่แล้ว +3

    you guys should quit complaining.why would you learn django without knowing bootstrap?
    having bootstrap doesnt change any functionality in here so its cool to do it on the background.
    bootstrap is for you guys to learn

    • @mitchjohnson4714
      @mitchjohnson4714 7 ปีที่แล้ว +2

      Because I'm focusing on back-end stuff. I just want a minimalistic front-end for now, and I can learn all about cool styling later on.

  • @taihatranduc8613
    @taihatranduc8613 5 ปีที่แล้ว

    fuck. I understand nothing

    • @Akash-hx9mn
      @Akash-hx9mn 4 ปีที่แล้ว

      Start from beginning.You will understand everything.

    • @taihatranduc8613
      @taihatranduc8613 4 ปีที่แล้ว

      Sorry for saying that. It's a long time ago. I mater Django now.

  • @Dadusingh1010
    @Dadusingh1010 7 ปีที่แล้ว

    can anyone tell me where (file) is our album(title,logo..) is store?

  • @Khan_2025
    @Khan_2025 6 ปีที่แล้ว

    'music:views' is not a viewname, how can i fix it

    • @superCharged24
      @superCharged24 6 ปีที่แล้ว

      hi how did you fix it?

    • @superCharged24
      @superCharged24 6 ปีที่แล้ว

      i got this same error, pls how did you fix it?