I'm new with Django Framework. I made a template in html using a script javascript. It looks like a chat. I want to put answers from user in my databases.
Here is the link with my code: https://codepen.io/maria-lupu-the-sasster/pen/abGdgPQ
And the end, after the "conversation" is over and appear the button "Let's go", I want all the details (that 'uid' and name) to be added in my databases.
There are my model where I want to add the details:
class Employee(models.Model):
employee_id = models.BigAutoField(primary_key=True)
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
u_id=models.CharField(max_length=20)
badge_number=models.CharField(max_length=50)
email_adress = models.CharField(max_length=300)
role = models.CharField(max_length=40)
def __str__(self):
return self.last_name
- for first_name and last_name I was thinking of doing a split to the string provided by the user (that time when the bot from chat ask user for his name)
- email_adress will be composed with uid+@gmail.com
I searched on google for many solutions, but I still don't know how to do it. I saw something with Ajax, but I don't know how to work with this. Please, can someone help me and explain me?