From e9c6066ff0392de0c35ed2f5d2f61aaee26b172e Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 23 Dec 2020 15:08:27 +0100 Subject: [PATCH] very basic view/form/template workflow added --- eva/urls.py | 3 ++- evapp/templates/evapp/employee_form.html | 1 + evapp/urls.py | 7 +++++++ evapp/views.py | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 evapp/templates/evapp/employee_form.html create mode 100644 evapp/urls.py diff --git a/eva/urls.py b/eva/urls.py index 55ec625..9417d51 100644 --- a/eva/urls.py +++ b/eva/urls.py @@ -14,8 +14,9 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path +from django.urls import path, include urlpatterns = [ + path('', include("evapp.urls")), path('admin/', admin.site.urls), ] diff --git a/evapp/templates/evapp/employee_form.html b/evapp/templates/evapp/employee_form.html new file mode 100644 index 0000000..40c080e --- /dev/null +++ b/evapp/templates/evapp/employee_form.html @@ -0,0 +1 @@ +{{form}} diff --git a/evapp/urls.py b/evapp/urls.py new file mode 100644 index 0000000..6978be9 --- /dev/null +++ b/evapp/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from .views import EvaFormView + +urlpatterns = [ + path('', EvaFormView.as_view(), name='evaform'), + ] diff --git a/evapp/views.py b/evapp/views.py index 91ea44a..17664fe 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -1,3 +1,9 @@ from django.shortcuts import render +from django.views.generic.edit import CreateView + +from .models import Employee # Create your views here. +class EvaFormView(CreateView): + model = Employee + fields = ['firstname']