Insert data in database in django 3

Shop Forums Django Discussion Insert data in database in django 3

Viewing 0 reply threads
  • Author
    Posts
    • #7177
      Projects Plaza
      Participant

      With the help of the following code, we can easily insert data into the database. Suppose we have a User model and want to register a new user via user registration form.

      
      def register_user(request):
       if request.method=='POST':
        full_name=request.POST['full_name']
        email=request.POST['email']
        username=request.POST['username']
        user=User.objects.create(full_name=full_name,email=email,username=username)
      
Viewing 0 reply threads
  • You must be logged in to reply to this topic.