diff --git a/UGSdjangoProject/.idea/UGSdjangoProject.iml b/UGSdjangoProject/.idea/UGSdjangoProject.iml index 4143bb4..334dbf5 100644 --- a/UGSdjangoProject/.idea/UGSdjangoProject.iml +++ b/UGSdjangoProject/.idea/UGSdjangoProject.iml @@ -26,6 +26,7 @@ diff --git a/UGSdjangoProject/ugssim/form.py b/UGSdjangoProject/ugssim/form.py index 13def69..b735fc6 100644 --- a/UGSdjangoProject/ugssim/form.py +++ b/UGSdjangoProject/ugssim/form.py @@ -1,10 +1,32 @@ from django import forms - -from django import forms -from .models import Address +from .models import * class AddressForm(forms.ModelForm): class Meta: model = Address fields = ['vorname', 'nachname', 'geburtstag', 'street', 'hausnummer', 'postleitzahl'] + + +class SummaryForm(forms.ModelForm): + class Meta: + model = Summary + fields = '__all__' + + +class SalesAreaTypeForm(forms.ModelForm): + class Meta: + model = SalesAreaType + fields = '__all__' + + +class SalesAreaForm(forms.ModelForm): + class Meta: + model = SalesArea + fields = '__all__' + + +class CompanyDataForm(forms.ModelForm): + class Meta: + model = CompanyData + fields = '__all__' diff --git a/UGSdjangoProject/ugssim/models.py b/UGSdjangoProject/ugssim/models.py index 9979075..db7f433 100644 --- a/UGSdjangoProject/ugssim/models.py +++ b/UGSdjangoProject/ugssim/models.py @@ -1,3 +1,4 @@ +from django import forms from django.db import models # Create your models here. @@ -12,4 +13,24 @@ class Address(models.Model): def __str__(self): return f'{self.vorname} {self.nachname} lives at {self.street} {self.hausnummer}, {self.postleitzahl}' +class Summary(models.Model): + text = models.TextField(max_length=2000) + + def __str__(self): + return self.text + +class SalesAreaType(models.Model): + title = models.CharField(max_length=255) + + +class SalesArea(models.Model): + title = models.CharField(max_length=255) + type = models.ForeignKey(SalesAreaType, on_delete=models.RESTRICT) + + +class CompanyData(models.Model): + title = models.CharField(max_length=255) + website = models.URLField(max_length=200) + startDate = models.DateField() + salesArea = models.ManyToManyField(SalesArea, related_name='+') diff --git a/UGSdjangoProject/ugssim/templates/planungsparameter/companydata.html b/UGSdjangoProject/ugssim/templates/planungsparameter/companydata.html new file mode 100644 index 0000000..8d31767 --- /dev/null +++ b/UGSdjangoProject/ugssim/templates/planungsparameter/companydata.html @@ -0,0 +1,12 @@ +
+
+ {% csrf_token %} + {% for field in companyDataForm %} +
+ + +
+ {% endfor %} + +
+
\ No newline at end of file diff --git a/UGSdjangoProject/ugssim/templates/planungsparameter/mandantendaten.html b/UGSdjangoProject/ugssim/templates/planungsparameter/mandantendaten.html new file mode 100644 index 0000000..1bbe4b3 --- /dev/null +++ b/UGSdjangoProject/ugssim/templates/planungsparameter/mandantendaten.html @@ -0,0 +1,12 @@ +
+
+ {% csrf_token %} + {% for field in addressForm %} +
+ + +
+ {% endfor %} + +
+
\ No newline at end of file diff --git a/UGSdjangoProject/ugssim/templates/planungsparameter/planungsparameter.html b/UGSdjangoProject/ugssim/templates/planungsparameter/planungsparameter.html index 566549b..d817292 100644 --- a/UGSdjangoProject/ugssim/templates/planungsparameter/planungsparameter.html +++ b/UGSdjangoProject/ugssim/templates/planungsparameter/planungsparameter.html @@ -1,10 +1,48 @@ - - - - - Title - - +{% extends 'ugssim/ugssim.html' %} +{% block content %} +
+
+

+ +

+
+
+ {% include 'planungsparameter/mandantendaten.html' %} +
+
+
+
+

+ +

- - \ No newline at end of file + +
+
+ {% include 'planungsparameter/summary.html' %} +
+
+
+
+

+ +

+
+
+ {% include 'planungsparameter/companydata.html' %} +
+
+
+
+ +{% endblock content %} + \ No newline at end of file diff --git a/UGSdjangoProject/ugssim/templates/planungsparameter/summary.html b/UGSdjangoProject/ugssim/templates/planungsparameter/summary.html new file mode 100644 index 0000000..46d35ea --- /dev/null +++ b/UGSdjangoProject/ugssim/templates/planungsparameter/summary.html @@ -0,0 +1,12 @@ +
+
+ {% csrf_token %} + {% for field in summaryForm %} +
+ + +
+ {% endfor %} + +
+
\ No newline at end of file diff --git a/UGSdjangoProject/ugssim/templates/ugssim/address.html b/UGSdjangoProject/ugssim/templates/ugssim/address.html index 9c73fea..d2a9c99 100644 --- a/UGSdjangoProject/ugssim/templates/ugssim/address.html +++ b/UGSdjangoProject/ugssim/templates/ugssim/address.html @@ -12,6 +12,5 @@ - - + {% endblock content %} \ No newline at end of file diff --git a/UGSdjangoProject/ugssim/templates/ugssim/home.html b/UGSdjangoProject/ugssim/templates/ugssim/home.html index c5ba623..f15e0c5 100644 --- a/UGSdjangoProject/ugssim/templates/ugssim/home.html +++ b/UGSdjangoProject/ugssim/templates/ugssim/home.html @@ -13,7 +13,44 @@ Nicaragua, Niederlande, Peru, Polen, Rumänien, Slowenien, USA und Usbekistan. M Gründungsplanspiel UGS® GAME haben bereits mehrere tausende potenzielle Gründer die Existenzgründerrolle trainiert.

- +
+
+

+ +

+
+
+ This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. +
+
+
+
+

+ +

+
+
+ This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. +
+
+
+
+

+ +

+
+
+ This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. +
+
+
+
diff --git a/UGSdjangoProject/ugssim/templates/ugssim/navigation.html b/UGSdjangoProject/ugssim/templates/ugssim/navigation.html index ea7aafd..eeb5e39 100644 --- a/UGSdjangoProject/ugssim/templates/ugssim/navigation.html +++ b/UGSdjangoProject/ugssim/templates/ugssim/navigation.html @@ -1,37 +1,43 @@ - + + diff --git a/UGSdjangoProject/ugssim/templates/ugssim/ugssim.html b/UGSdjangoProject/ugssim/templates/ugssim/ugssim.html index 5b3736b..98f55b7 100644 --- a/UGSdjangoProject/ugssim/templates/ugssim/ugssim.html +++ b/UGSdjangoProject/ugssim/templates/ugssim/ugssim.html @@ -1,4 +1,5 @@ {% load static %} + diff --git a/UGSdjangoProject/ugssim/urls.py b/UGSdjangoProject/ugssim/urls.py index 4d6f9fb..a2acb85 100644 --- a/UGSdjangoProject/ugssim/urls.py +++ b/UGSdjangoProject/ugssim/urls.py @@ -2,8 +2,9 @@ from django.urls import path from . import views urlpatterns = [ - path('',views.index, name='ugs_index'), - path('input/',views.input, name='ugs_input'), - path('address/',views.address, name='ugs_address'), - # path('tables/',views.tables, name='ugstables'), -] \ No newline at end of file + path('', views.index, name='ugs_index'), + path('input/', views.input, name='ugs_input'), + path('address/', views.address, name='ugs_address'), + path('planungsparameter/', views.planungsparameter, name='ugs_planungsparameter'), + # path('tables/',views.tables, name='ugstables'), +] diff --git a/UGSdjangoProject/ugssim/views.py b/UGSdjangoProject/ugssim/views.py index 3e89bea..afb5ca0 100644 --- a/UGSdjangoProject/ugssim/views.py +++ b/UGSdjangoProject/ugssim/views.py @@ -2,7 +2,7 @@ from django.shortcuts import render from django.http import HttpResponse from django.template import loader from django.shortcuts import render -from .form import AddressForm +from .form import * from django.views.generic import TemplateView @@ -14,18 +14,53 @@ from django.views.generic import TemplateView def index(request): - template = loader.get_template('ugssim/home.html') - return HttpResponse(template.render()) + return render(request, 'ugssim/home.html') + + +def planungsparameter(request): + if request.method == 'POST': + addressForm = AddressForm(request.POST) + if addressForm.is_valid(): + addressForm.save() + else: + addressForm = AddressForm() + + if request.method == 'POST': + summaryForm = SummaryForm(request.POST) + if summaryForm.is_valid(): + summaryForm.save() + else: + summaryForm = SummaryForm() + + context = { + 'addressForm': addressForm, + 'summaryForm': summaryForm + } + + if request.method == 'POST': + companyDataForm = CompanyDataForm(request.POST) + if companyDataForm.is_valid(): + companyDataForm.save() + else: + companyDataForm = CompanyDataForm() + + context = { + 'addressForm': addressForm, + 'summaryForm': summaryForm, + 'companyDataForm': companyDataForm + } + + return render(request, 'planungsparameter/planungsparameter.html', context) def companydata(request): template = loader.get_template('ugssim/companydata.html') - return HttpResponse(template.render()) + return HttpResponse(template.render(request)) def input(request): template = loader.get_template('ugssim/companydata.html') - return HttpResponse(template.render()) + return HttpResponse(template.render(request)) '''