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

Sdílet
Vložit
  • čas přidán 9. 09. 2024

Komentáře • 110

  • @ProgrammingWithHarry
    @ProgrammingWithHarry  Před 4 lety +5

    Here is the playlist: czcams.com/play/PLK8cqdr55Tsv-D2HMdrnD32oOVBNvmxjr.html
    If possible please share it with your friends :)

    • @salvindsouza7053
      @salvindsouza7053 Před 4 lety

      what is models.model argument? How it works ?

    • @hommastonlimited3187
      @hommastonlimited3187 Před 2 lety

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

    • @amanchaurasia
      @amanchaurasia Před 2 lety

      I M getting typeerror

  • @nikhil154
    @nikhil154 Před 3 lety +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 Před 2 lety +7

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

  • @hommastonlimited3187
    @hommastonlimited3187 Před 2 lety +2

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

  • @tino9049
    @tino9049 Před 4 lety +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 Před 2 lety

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

  • @engineerbhai7642
    @engineerbhai7642 Před 4 lety +1

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

  • @thekishore8408
    @thekishore8408 Před 2 lety

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

  • @ronmanmemes5826
    @ronmanmemes5826 Před 2 lety +1

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

  • @user-em8mh7fd2i
    @user-em8mh7fd2i Před 4 lety +1

    Love From Gujarat Dhiren Nathvani
    😍😍😍😍

  • @deepanshuyadavcs1379
    @deepanshuyadavcs1379 Před 2 lety

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

  • @gururaj2199
    @gururaj2199 Před 4 lety +2

    Cool

  • @aninstinctkiller
    @aninstinctkiller Před 3 lety

    Thanks! this solved my problem pretty neatly!

  • @milespearce
    @milespearce Před 2 lety

    Thanks Harry, this was very helpful.

  • @lyricsbeatz
    @lyricsbeatz Před 4 lety +2

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

  • @codewithharryfanchannel559

    Well Explained. God bless you sir.

  • @shanksharma5117
    @shanksharma5117 Před rokem

    unbelievable !!

  • @krishanasaini952
    @krishanasaini952 Před 3 lety

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

  • @zorro-fq1zq
    @zorro-fq1zq Před 3 lety

    Everything is working. Thanks.

  • @LetterfromourDearGod
    @LetterfromourDearGod Před 3 lety

    Excellent Tutorial, worked perfectly for me, Thank You.

    • @hommastonlimited3187
      @hommastonlimited3187 Před 2 lety

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

    • @28_vyankteshbarlawar59
      @28_vyankteshbarlawar59 Před 2 lety

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

  • @kinjarapulokeswararao709
    @kinjarapulokeswararao709 Před 2 lety +1

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

  • @karthikr8905
    @karthikr8905 Před 3 lety

    Great.. Thanks for the video

  • @Aakib180
    @Aakib180 Před 4 lety

    Thats very good video harry bhai

  • @komalsharma-ml3yb
    @komalsharma-ml3yb Před 3 lety

    Thank you so much! Extremely helpful. ^_^

  • @RohanDasRD
    @RohanDasRD Před 4 lety

    Awesome work bhai

  • @aarifalam1785
    @aarifalam1785 Před rokem

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

  • @BowGazalh
    @BowGazalh Před 3 lety

    Very clear

  • @vivekjalankar6647
    @vivekjalankar6647 Před 4 lety +1

    Sir python practice program main chatbot bananekha video bana dijiye pls

  • @sailendrachettri966
    @sailendrachettri966 Před 4 lety

    Thank you sir ji..!!

  • @alexene1587
    @alexene1587 Před 4 lety +2

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

  • @briankapito7034
    @briankapito7034 Před 3 lety

    thanks

  • @rafsanjahin9905
    @rafsanjahin9905 Před 2 lety

    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

  • @beshy9012
    @beshy9012 Před 3 lety

    thank you for this

  • @abhicruz1668
    @abhicruz1668 Před 2 lety +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 Před 2 lety

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

  • @utkarshshukla6531
    @utkarshshukla6531 Před 4 lety +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 Před 4 lety +2

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

    • @techysam4646
      @techysam4646 Před 3 lety

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

    • @mohammedalqudah7329
      @mohammedalqudah7329 Před 2 lety

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

  • @amanchaurasia9880
    @amanchaurasia9880 Před 4 lety +1

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

  • @channelpro2284
    @channelpro2284 Před 4 lety

    Love you Harry.

  • @increadibleangel7980
    @increadibleangel7980 Před 3 lety

    ur too good

  • @rikhavthakkar2015
    @rikhavthakkar2015 Před 2 lety

    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?

  • @mdikbalhosen1711
    @mdikbalhosen1711 Před 3 lety

    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

  • @misfarsiddeek3105
    @misfarsiddeek3105 Před 3 lety

    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.

  • @ndhijazi2188
    @ndhijazi2188 Před 3 lety

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

  • @sonamkori8169
    @sonamkori8169 Před 3 lety

    thank u

  • @hommastonlimited3187
    @hommastonlimited3187 Před 2 lety

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

  • @khizerrashid3822
    @khizerrashid3822 Před 3 lety

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

  • @SahilAnni
    @SahilAnni Před 5 měsíci

    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']. :)

  • @dell4559
    @dell4559 Před 4 lety +1

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

  • @RAVIGUPTA-wv8gn
    @RAVIGUPTA-wv8gn Před 4 lety

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

  • @furkanekici236
    @furkanekici236 Před 3 lety

    so helpful. thanks!

  • @prateeksoni2435
    @prateeksoni2435 Před 3 lety

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

  • @sarthaknirala8894
    @sarthaknirala8894 Před 3 lety

    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

  • @godriceeichie
    @godriceeichie Před 3 lety

    please abeg which one is 'endpoint'

  • @nivethaj8295
    @nivethaj8295 Před rokem

    How to comment out?

  • @parthverma6652
    @parthverma6652 Před 3 lety

    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!

  • @kanchannamdev739
    @kanchannamdev739 Před 3 lety

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

  • @gamert2525
    @gamert2525 Před 4 lety +1

    7th
    👌

  • @logeshlyrics772
    @logeshlyrics772 Před 2 lety

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

  • @nishantsharma9118
    @nishantsharma9118 Před 3 lety

    How can we save dropdown in database

  • @MrKhanPubg7
    @MrKhanPubg7 Před 2 lety

    I'm got an error

  • @techysam4646
    @techysam4646 Před 3 lety

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

  • @javedbakshi9793
    @javedbakshi9793 Před 3 lety +1

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

    • @javedbakshi9793
      @javedbakshi9793 Před 3 lety +1

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

    • @sarthaknirala8894
      @sarthaknirala8894 Před 3 lety

      Just add {% csrf_token %}
      After the tag

    • @zainulabdeen7074
      @zainulabdeen7074 Před 2 lety

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

  • @shuvo-d-4839
    @shuvo-d-4839 Před 2 lety

    20:45

  • @stonecodesteveaustin4507

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

  • @ismailhasansarker3733
    @ismailhasansarker3733 Před 4 lety +2

    Contact() got an unexpected keyword argument 'email'

  • @harshadtambe99
    @harshadtambe99 Před 3 lety

    my data is not going in db

  • @Priyak0416
    @Priyak0416 Před 3 lety

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

  • @shuvo-d-4839
    @shuvo-d-4839 Před 2 lety

    10:34

  • @zainulabdeen7074
    @zainulabdeen7074 Před 2 lety

    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 Před rokem

      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 Před rokem

      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 Před rokem

      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 Před rokem

      try this 🇲🇦💪

  • @mofiathamin4908
    @mofiathamin4908 Před 4 lety

    Give us thé link of code in github thanks

  • @ChetanSharma-oy4ge
    @ChetanSharma-oy4ge Před 3 lety

    where is source code?

  • @shubhamjaiswal7925
    @shubhamjaiswal7925 Před 4 lety +2

    contact() got an unexpected keyword argument 'name'

  • @manhdoan199x3
    @manhdoan199x3 Před 3 lety

    please code

  • @bamanevishwajeet
    @bamanevishwajeet Před 4 lety +1

    Heart plzz

  • @bamanevishwajeet
    @bamanevishwajeet Před 4 lety

    First

  • @vishalmishra1937
    @vishalmishra1937 Před 4 lety

    atleast put github link

  • @shuvo-d-4839
    @shuvo-d-4839 Před 2 lety

    20:12