basic form workflow added
This commit is contained in:
parent
229f35f816
commit
da8b58279f
|
@ -15,6 +15,8 @@ from pathlib import Path
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
|
# mails in development go to stdout
|
||||||
|
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from .models import Employee
|
||||||
|
|
||||||
# Register your models here.
|
admin.site.register([
|
||||||
|
Employee,
|
||||||
|
])
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from .views import EvaFormView
|
from .views import EvaFormView, success
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', EvaFormView.as_view(), name='evaform'),
|
path('', EvaFormView.as_view(), name='evaform'),
|
||||||
|
path('success', success, name='success')
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
from django.shortcuts import render
|
|
||||||
from django.views.generic.edit import CreateView
|
from django.views.generic.edit import CreateView
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.http import HttpResponse
|
||||||
|
|
||||||
from .models import Employee
|
from .models import Employee
|
||||||
from .forms import EmployeeForm
|
from .forms import EmployeeForm
|
||||||
|
|
||||||
# Create your views here.
|
def success(request):
|
||||||
|
return HttpResponse("gut gemacht!")
|
||||||
|
|
||||||
class EvaFormView(CreateView):
|
class EvaFormView(CreateView):
|
||||||
model = Employee
|
model = Employee
|
||||||
# fields = '__all__' # ['firstname']
|
|
||||||
form_class = EmployeeForm
|
form_class = EmployeeForm
|
||||||
|
|
||||||
|
def get_success_url(self):
|
||||||
|
return reverse('success')
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
print("VALIDE!!!")
|
||||||
|
return super().form_valid(form)
|
||||||
|
|
Loading…
Reference in New Issue