This repository has been archived by the owner on Jun 20, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making the third step definition works
- Loading branch information
Showing
3 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django import forms | ||
from models import Student | ||
|
||
class StudentForm(forms.ModelForm): | ||
class Meta: | ||
model = Student |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> | ||
<title>New student</title> | ||
</head> | ||
<body id=""> | ||
{{ form.as_p }} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Create your views here. | ||
from django.http import HttpResponse | ||
from django.shortcuts import render_to_response | ||
from django.template import RequestContext | ||
from forms import StudentForm | ||
|
||
def new_student(request): | ||
return HttpResponse('Hi!') | ||
form = StudentForm() | ||
return render_to_response('form_new_student.html', { | ||
'form' : form | ||
}, context_instance=RequestContext(request) | ||
) |