Я новичок в Django, я создал модель и пытаюсь опубликовать данные из внешнего интерфейса.ниже моя view.py
def studentForm(request):
userProfile = StudentProfileForm.objects.create(FirstName=request.POST['userFirstName'] LastName=request.POST['userLastName'], GreScore= request.POST['userGreScore'], IELTSTOEFL=request.POST['userIeltsToefl'],WorkEx=request.POST['userWorkEx'],ResearchDone=request.POST['userResearch'])
userProfile.save()
return render(request,'register/bg-pages.html')
ниже моя модель
class StudentProfileForm(models.Model):
FirstName = models.CharField(max_length=255)
LastName = models.CharField(max_length=255)
GreScore = models.IntegerField()
IELTSTOEFL = models.IntegerField()
WorkEx = models.IntegerField()
ResearchDone = models.IntegerField()
Ошибка следующая: Запрос
Method: GET
Request URL: http://127.0.0.1:8000/student_form
Django Version: 2.1.5
Exception Type: MultiValueDictKeyError
Exception Value:
'userFirstName'
Exception Location: C:\Users\AB\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\datastructures.py in __getitem__, line 79
Python Executable: C:\Users\AB\AppData\Local\Programs\Python\Python37-32\python.exe
Python Version: 3.7.1
Python Path:
['D:\\AB\\UOR_everything\\semester_2(winter_2019)\\Software_Engineering\\login_registration',
'C:\\Users\\AB\\AppData\\Local\\Programs\\Python\\Python37-32\\python37.zip',
'C:\\Users\\AB\\AppData\\Local\\Programs\\Python\\Python37-32\\DLLs',
'C:\\Users\\AB\\AppData\\Local\\Programs\\Python\\Python37-32\\lib',
'C:\\Users\\AB\\AppData\\Local\\Programs\\Python\\Python37-32',
'C:\\Users\\AB\\AppData\\Roaming\\Python\\Python37\\site-packages',
'C:\\Users\\AB\\AppData\\Local\\Programs\\Python\\Python37-32\\lib\\site-packages']
Server time: Sun, 10 Mar 2019 00:35:51 +0000