Models in Django: Saving Form Data To The Database | Django Tutorial #10

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 110

  • @ProgrammingWithHarry
    @ProgrammingWithHarry  4 года назад +5

    Here is the playlist: ruclips.net/p/PLK8cqdr55Tsv-D2HMdrnD32oOVBNvmxjr
    If possible please share it with your friends :)

    • @salvindsouza7053
      @salvindsouza7053 4 года назад

      what is models.model argument? How it works ?

    • @hommastonlimited3187
      @hommastonlimited3187 2 года назад

      My problem is almost solved. thank you so much!! How do I solve the "unexpected keyword arguement" problem

    • @amanchaurasia
      @amanchaurasia 2 года назад

      I M getting typeerror

  • @nikhil154
    @nikhil154 3 года назад +7

    Why didn't youtube recommend me your channel is beyond my comprehension . Dude , you are damn good . I could have saved days on learning the concepts.

  • @aliemarah
    @aliemarah 2 года назад +7

    Your Django tutorials are by far the best tutorials on this platform.

  • @hommastonlimited3187
    @hommastonlimited3187 2 года назад +2

    I realised i was not patient enough. Your tutorial is actually the best on this youtube platform

  • @thekishore8408
    @thekishore8408 2 года назад

    You are make me happy 🔥...I did it my 1st django website..❤️

  • @engineerbhai7642
    @engineerbhai7642 4 года назад +1

    It is very helpful. You are best coder in you tube.

  • @ronmanmemes5826
    @ronmanmemes5826 3 года назад +1

    It helped me a lot in my career thanks man keep working

  • @tino9049
    @tino9049 4 года назад +3

    I only get contact() got an unexpected keyword argument 'name' when i clicked on submit, what could be the problem?
    This is my code:
    def contact(request):
    if request.method=="POST":
    name = request.POST["name"]
    email = request.POST["email"]
    phone = request.POST["phone"]
    desc = request.POST["desc"]
    #print(name, email,phone,desc)
    ins = contact(name=name,email=email,phone=phone,desc=desc)
    ins.save()
    print("The data has been saved.")
    return render(request, "contact.html")

    • @zainulabdeen7074
      @zainulabdeen7074 2 года назад

      did you solve this error? then please tell how to solve this?

  • @TOP10-s3v1l
    @TOP10-s3v1l 4 года назад +1

    Love From Gujarat Dhiren Nathvani
    😍😍😍😍

  • @deepanshuyadavcs1379
    @deepanshuyadavcs1379 3 года назад

    This is the video I was looking for. Thanku, my conecpt is clear now

  • @milespearce
    @milespearce 2 года назад

    Thanks Harry, this was very helpful.

  • @lyricsbeatz
    @lyricsbeatz 4 года назад +2

    Hello having issues with the contact section the submit is no going through

  • @codewithharryfanchannel559
    @codewithharryfanchannel559 4 года назад +1

    Well Explained. God bless you sir.

  • @krishanasaini952
    @krishanasaini952 3 года назад

    I was very nice to know how to going data to the database

  • @LetterfromourDearGod
    @LetterfromourDearGod 3 года назад

    Excellent Tutorial, worked perfectly for me, Thank You.

    • @hommastonlimited3187
      @hommastonlimited3187 2 года назад

      please any help? at the end it says "unexpected keyword argument"

    • @28_vyankteshbarlawar59
      @28_vyankteshbarlawar59 2 года назад

      @@hommastonlimited3187 check your names of html ,model and function it should be same while passing into the function

  • @aninstinctkiller
    @aninstinctkiller 3 года назад

    Thanks! this solved my problem pretty neatly!

  • @abhicruz1668
    @abhicruz1668 2 года назад +1

    I wrote the exact code but iam getting an error saying"MultiValueDictKeyError at /contact
    'name'" plz help me to get rid of this error

    • @zainulabdeen7074
      @zainulabdeen7074 2 года назад

      did you solve this error? then please tell how to solve this?

  • @misfarsiddeek3105
    @misfarsiddeek3105 4 года назад

    In this case we've use raw html form. Can't we use django forms or Model form for this? With the same bootstrap styles? Bcz, those are very powerful forms. But I don't know how to make those form with interactive designs. Hope u will answer for this. Thanks.

  • @rikhavthakkar2015
    @rikhavthakkar2015 2 года назад

    Bro, Need a quick help.... I have been learing Django from ur videos and stuck somewhere. I am working on a page which has 2 fields - years and months as fields and trying to store in SQLite. In the data base both are defined as models.PositiveIntegerField(default=0, blank=True)
    Now from the html page I am trying to enter the data and keeping one of the fields as blank. I keep getting the below mentioned error
    Field 'years' expected a number but got ''.
    Can you help and tell me how to fix this issue?

  • @Aakib180
    @Aakib180 4 года назад

    Thats very good video harry bhai

  • @rafsanjahin9905
    @rafsanjahin9905 2 года назад

    Hi! I NEED HELP! PLEASE! How can i do post method when I have only one html file where the pages are created using id? Please explain

  • @zorro-fq1zq
    @zorro-fq1zq 4 года назад

    Everything is working. Thanks.

  • @karthikr8905
    @karthikr8905 3 года назад

    Great.. Thanks for the video

  • @mdikbalhosen1711
    @mdikbalhosen1711 3 года назад

    In the beginning, my app folder name was home2, then after few tutorial and work i rename it as home. Now when I add home at installed app and save it ,it show that " django.core.exceptions.ImproperlyConfigured: Cannot import 'home2'. Check that 'home.apps.Home2Config.name' is correct." how can I solve this probelm. Someone please help me. I am stuck here

  • @RohanDasRD
    @RohanDasRD 4 года назад

    Awesome work bhai

  • @ndhijazi2188
    @ndhijazi2188 3 года назад

    Hello , i want to ask if your mithod contact has another argument, means like this :
    Contact(request,mynumber)
    How you will write form action ?

  • @alexene1587
    @alexene1587 4 года назад +2

    i spent like 2h to solve the issue, it seems that the action field was wrong, silly me

  • @vivekjalankar6647
    @vivekjalankar6647 4 года назад +1

    Sir python practice program main chatbot bananekha video bana dijiye pls

  • @utkarshshukla6531
    @utkarshshukla6531 4 года назад +2

    7.20 everything is fine but my form is not responded. I am clicking on submit button but no response, no error found . I am sad. Anyone suggest me what's the issue?

    • @TheRealtorsEstate
      @TheRealtorsEstate 4 года назад +2

      use "POST" like this in views.py not this "post"

    • @techysam4646
      @techysam4646 3 года назад

      Same issue 😭😭 please help me i have used 'POST' LIKE only

    • @mohammedalqudah7329
      @mohammedalqudah7329 2 года назад

      @@TheRealtorsEstate i had the same problem, and i do it like u mentioned and It's work, thank you :D

  • @komalsharma-ml3yb
    @komalsharma-ml3yb 3 года назад

    Thank you so much! Extremely helpful. ^_^

  • @aarifalam1785
    @aarifalam1785 Год назад

    in this course this #10 part is the most important.

  • @amanchaurasia9880
    @amanchaurasia9880 4 года назад +1

    sir i m still getting the same issue please dont run from it help us by making the problem go away

  • @shanksharma5117
    @shanksharma5117 Год назад

    unbelievable !!

  • @khizerrashid3822
    @khizerrashid3822 3 года назад

    Can we create table directly in sql instead of creating in django?

  • @gururaj2199
    @gururaj2199 4 года назад +2

    Cool

  • @hommastonlimited3187
    @hommastonlimited3187 2 года назад

    how is this possible. I did everything you did but I still get UNEXPECTED KEYWORD ARGUEMENT ERROR

  • @BowGazalh
    @BowGazalh 3 года назад

    Very clear

  • @RAVIGUPTA-wv8gn
    @RAVIGUPTA-wv8gn 4 года назад

    why you do not upload this video in the main channel?

  • @dell4559
    @dell4559 4 года назад +1

    I got problem in 24:10 that IntegrityError NOT NULL constraint failed: app_user.cat_id

  • @sailendrachettri966
    @sailendrachettri966 4 года назад

    Thank you sir ji..!!

  • @sarthaknirala8894
    @sarthaknirala8894 3 года назад

    21:24 getting an error
    DataError : integer out of range
    I searched on Google it says replace int to bigint but im not using thatt . Can anyone help. Thanks in advance

  • @kinjarapulokeswararao709
    @kinjarapulokeswararao709 3 года назад +1

    I'm getting Multilevel dictkey error.
    Plese solve this error

  • @SahilAnni
    @SahilAnni 7 месяцев назад

    oops I finally got the error. I wrote contact name as phone in HTML but in view file I wrote request.POST['contact']. which should be. request.POST['phone']. :)

  • @parthverma6652
    @parthverma6652 4 года назад

    I have a data type as (input type="radio") in HTML file and I cant find appropriate model attribute for the same please help me out someone!

  • @prateeksoni2435
    @prateeksoni2435 3 года назад

    i am getting this error while executing the same code
    'local variable 'name' referenced before assignment' Can anyone help me?

  • @kanchannamdev739
    @kanchannamdev739 3 года назад

    How to store data in django models if the method ="GET" ???

  • @increadibleangel7980
    @increadibleangel7980 4 года назад

    ur too good

  • @channelpro2284
    @channelpro2284 4 года назад

    Love you Harry.

  • @logeshlyrics772
    @logeshlyrics772 3 года назад

    ModuleNotFoundError: No module named 'models what can i do for resolve this

  • @godriceeichie
    @godriceeichie 4 года назад

    please abeg which one is 'endpoint'

  • @zainulabdeen7074
    @zainulabdeen7074 2 года назад

    Hello Harry Sir ! kindly read comments here ..everyone have one common issue which is when we submit data to db.we are getting an error (Typeerror at contact: contact got an unexpected arguments name.....so plz give us a solution....

    • @amdzhr
      @amdzhr Год назад

      hey to fix this issue, you can try renaming either the function or the model to have a different name. Make sure that the function and model names are not the same to avoid naming conflicts.

    • @amdzhr
      @amdzhr Год назад

      from django.shortcuts import render, HttpResponse
      from home.models import Contact
      def home(request):
      return render(request, 'home.html')
      def about(request):
      return render(request, 'about.html')
      def projects(request):
      return render(request, 'projects.html')
      def contact_form(request):
      if request.method == "POST":
      name = request.POST['name']
      email = request.POST['email']
      phone = request.POST['phone']
      desc = request.POST.get('desc', '')
      contact = Contact(name=name, email=email, phone=phone, desc=desc)
      contact.save()
      print('Data has been saved to the database')
      return render(request, 'contact.html')

    • @amdzhr
      @amdzhr Год назад

      from django.db import models
      class Contact(models.Model):
      name = models.CharField(max_length=30)
      email = models.EmailField()
      phone = models.CharField(max_length=10)
      desc = models.TextField()

    • @amdzhr
      @amdzhr Год назад

      try this 🇲🇦💪

  • @javedbakshi9793
    @javedbakshi9793 3 года назад +1

    Hello Harry bhai ,
    I was stuck at 7:12 of this video .
    Please help me .

    • @javedbakshi9793
      @javedbakshi9793 3 года назад +1

      Having issue in Contact section Submit not going through . Please help me

    • @sarthaknirala8894
      @sarthaknirala8894 3 года назад

      Just add {% csrf_token %}
      After the tag

    • @zainulabdeen7074
      @zainulabdeen7074 2 года назад

      @@javedbakshi9793 did you solve this error? then please tell how to solve this?

  • @furkanekici236
    @furkanekici236 3 года назад

    so helpful. thanks!

  • @beshy9012
    @beshy9012 4 года назад

    thank you for this

  • @stonecodesteveaustin4507
    @stonecodesteveaustin4507 4 года назад

    Are you an Indian or a Jewish guy doing an Appu.... Subscribed

  • @ismailhasansarker3733
    @ismailhasansarker3733 4 года назад +2

    Contact() got an unexpected keyword argument 'email'

    • @t.d.prasanthx6636
      @t.d.prasanthx6636 3 года назад +1

      Are you solve this? Tell me that

    • @zainulabdeen7074
      @zainulabdeen7074 2 года назад

      did you solve this error? then please tell how to solve this?

  • @nishantsharma9118
    @nishantsharma9118 3 года назад

    How can we save dropdown in database

  • @briankapito7034
    @briankapito7034 3 года назад

    thanks

  • @techysam4646
    @techysam4646 3 года назад

    Submit doesn't return any data 🥴 please help me resolve this

  • @gamert2525
    @gamert2525 4 года назад +1

    7th
    👌

  • @sonamkori8169
    @sonamkori8169 3 года назад

    thank u

  • @shubhamjaiswal7925
    @shubhamjaiswal7925 4 года назад +2

    contact() got an unexpected keyword argument 'name'

  • @Priyak0416
    @Priyak0416 3 года назад

    anyone can please tell me how to submit pdf file and restore in database?

  • @nivethaj8295
    @nivethaj8295 Год назад

    How to comment out?

  • @mofiathamin4908
    @mofiathamin4908 4 года назад

    Give us thé link of code in github thanks

  • @MrKhanPubg7
    @MrKhanPubg7 3 года назад

    I'm got an error

  • @ChetanSharma-oy4ge
    @ChetanSharma-oy4ge 4 года назад

    where is source code?

  • @harshadtambe99
    @harshadtambe99 3 года назад

    my data is not going in db

  • @bamanevishwajeet
    @bamanevishwajeet 4 года назад +1

    Heart plzz

  • @shuvo-d-4839
    @shuvo-d-4839 2 года назад

    20:45

  • @manhdoan199x3
    @manhdoan199x3 3 года назад

    please code

  • @shuvo-d-4839
    @shuvo-d-4839 2 года назад

    10:34

  • @vishalmishra1937
    @vishalmishra1937 4 года назад

    atleast put github link

  • @crazyprogrammer1261
    @crazyprogrammer1261 4 года назад

    9:43

  • @bamanevishwajeet
    @bamanevishwajeet 4 года назад

    First

  • @shuvo-d-4839
    @shuvo-d-4839 2 года назад

    20:12