Lms website - Profile update function in python django

Learning Management System Project is an online video course platform such as Udemy. In lms website project you will get to learn many logics about python django. You can create and sell your own course in the Learning Management System website project. Razorpay payment gateway is used in lms project, with the help of which real payment can be accepted. Learning Management System Website Using Python Django - Overview and Demo | LMS Website | Online Video Course Website Project Using Python Django | Python | Django



{% extends 'base.html' %}
{% block content %}

<!-- PAGE TITLE
    ================================================== -->
    <header class="py-8 py-md-11" style="background-image: none;">
        <div class="container text-center py-xl-2">
            <h1 class="display-4 fw-semi-bold mb-0">Profile Update</h1>
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb breadcrumb-scroll justify-content-center">
                    <li class="breadcrumb-item">
                        <a class="text-gray-800" href="#">
                            Home
                        </a>
                    </li>
                    <li class="breadcrumb-item text-gray-800 active" aria-current="page">
                        Profile Update
                    </li>
                </ol>
            </nav>
        </div>
        <!-- Img -->
        <img class="d-none img-fluid" src="...html" alt="...">
    </header>
    <!-- Card -->
            <div class="card" style="width:80%;margin-left:10%;">
              <div class="card-body" >
             
                <form>
                    
                  <div class="row">
                        <div class="col">
                            <div class="form-group mb-4">
                              <label>First Name</label>
                             <input type="text" class="form-control"  placeholder="Enter First Name" name="first_name">
                            </div>
                        </div>
                        <div class="col">
                            <div class="form-group mb-4">
                              <label>Last Name</label>
                              <input type="text" class="form-control" placeholder="Enter Last Name" name="last_name">
                            </div>
                        </div>
                        <div class="w-100"></div>
                        <div class="col">
                             <div class="form-group mb-4">
                                <label>Email address</label>
                                <input type="email" class="form-control" placeholder="Enter Email" name="email">
                             </div>
                        </div>
                        <div class="col">
                            <div class="form-group mb-4">
                               <label>Username</label>
                               <input type="text" class="form-control" placeholder="Enter Username" name="username">
                            </div>
                        </div>
                      <div class="col-12">
                            <div class="form-group mb-4">
                               <label>Password</label>
                               <input type="password" class="form-control" placeholder="Fill Only If You Want To Change Password" name="password">
                            </div>
                        </div>
                  </div>
                  <button type="submit" class="btn btn-primary">Update Profile </button>
                </form>

              </div>
            </div>
{% endblock %}



Views.py


def Profile_Update(request):
    if request.method == "POST":
        username = request.POST.get('username')
        first_name = request.POST.get('first_name')
        last_name = request.POST.get('last_name')
        email = request.POST.get('email')
        password = request.POST.get('password')
        user_id = request.user.id

        user = User.objects.get(id=user_id)
        user.first_name = first_name
        user.last_name = last_name
        user.username = username
        user.email = email

        if password != None and password != "":
            user.set_password(password)
        user.save()
        messages.success(request,'Profile Are Successfully Updated. ')
        return redirect('profile')




Tags

#pythonlife #pythonprojects #pythonlanguage #pythonsnake #pythontutorial #pythonbaba #pythoninhindi #python3 #pythonbasics #pythoncourse #pythonclass11cbse #pythonclassattenkasi #pythoncode #pythoncoding #pythonchatbot #pythoncowboy #pythondash #pythondatasciencetutorial #pythondjango #pythonedureka #pythonessentials #pythonfrieght #pythonforbegginers #pythonforbeginners #pythonfordatascience #pythonfullcourse #pythonfullstackdevelopercourseinbangalore #pythonfullstackdevelopercourseinhyderabad #pythonfundamentals #pythongui #pythongraphics #pythonguitutorial #pythonhunting #pythonintelugu #pythonimageprocessing #pythonintree #pythoninterview #pythoninonevideo #pythoninterviewquestions #pythonintro #pythonjarvis #pythonkannada #pythonloginsystem #pythonlogintkinter #pythonlanguagefordsssbexam #pythonmockinterview #pythonmachinelearning #pythonmcq #pythonmalayalam #pythononlinetraining #pythonprojectusingsqlconnectivity #pythonprogrammingforbeginners #pythonprogrammingfullcourse #pythonprojectideas #pythonprogramming #pythonprograms #pythonprogramsintamil #pythonregex #pythonrevisiontour #pythonrightnow

Post a Comment

Previous Post Next Post

Contact Form