I am using Django to create a user and an object when the user is created.
But there is an error
Logs
Models.py
class doct(models.Model):
username = models.CharField(max_length=30)
pin = models.CharField(max_length=30)
mobile = models.CharField(max_length=30)
HTML.logs
<form action="update_data" method="POST">
{% csrf_token %}
<input type="text" name="username" placeholder="username"><br><br>
<input type="text" name="pin" placeholder="Password"><br><br>
<input type="text" name="mobile" placeholder="Mobile no"><br><br>
<button type="submit">submit</button>
</form>
Views.py
=========
def update_data(request):
if request.method=="POST":
username=request.POST["username"]
pin=request.POST["pin"]
mobile=request.POST["mobile"]
apppp =doct(username=username,pin=pin,mobile=mobile)
apppp.save()
error:
apppp =doct(username=username,pin=pin,mobile=mobile)
TypeError: doct() got an unexpected keyword argument 'username'
[30/Jun/2021 12:56:34] "POST /update_data HTTP/1.1" 500 65059