From 8cebb0fcd311c5228788be8044da05a879b7ce35 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 22 Sep 2020 12:21:05 +0200 Subject: [PATCH] first steps --- foerderbarometer/settings.py | 1 + foerderbarometer/urls.py | 3 ++- input/admin.py | 3 +++ input/migrations/0001_initial.py | 22 ++++++++++++++++++++++ input/models.py | 8 +++++++- input/urls.py | 7 +++++++ input/views.py | 5 +++++ 7 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 input/migrations/0001_initial.py create mode 100644 input/urls.py diff --git a/foerderbarometer/settings.py b/foerderbarometer/settings.py index af4005b..d9249c9 100644 --- a/foerderbarometer/settings.py +++ b/foerderbarometer/settings.py @@ -31,6 +31,7 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + 'input.apps.InputConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', diff --git a/foerderbarometer/urls.py b/foerderbarometer/urls.py index 8b280e3..d4bb31b 100644 --- a/foerderbarometer/urls.py +++ b/foerderbarometer/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("input.urls")), path('admin/', admin.site.urls), ] diff --git a/input/admin.py b/input/admin.py index 8c38f3f..4d6727b 100644 --- a/input/admin.py +++ b/input/admin.py @@ -1,3 +1,6 @@ from django.contrib import admin # Register your models here. +from .models import Project + +admin.site.register(Project) diff --git a/input/migrations/0001_initial.py b/input/migrations/0001_initial.py new file mode 100644 index 0000000..15dba58 --- /dev/null +++ b/input/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# Generated by Django 3.1.1 on 2020-09-22 09:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Project', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('project_name', models.CharField(max_length=200)), + ('project_start', models.DateTimeField(verbose_name='start date')), + ], + ), + ] diff --git a/input/models.py b/input/models.py index 71a8362..8d4ae93 100644 --- a/input/models.py +++ b/input/models.py @@ -1,3 +1,9 @@ from django.db import models -# Create your models here. + +class Project(models.Model): + project_name = models.CharField(max_length=200) + project_start = models.DateTimeField('start date') + + def __str__(self): + return self.project_name diff --git a/input/urls.py b/input/urls.py new file mode 100644 index 0000000..88a9cac --- /dev/null +++ b/input/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), +] diff --git a/input/views.py b/input/views.py index 91ea44a..65b3c80 100644 --- a/input/views.py +++ b/input/views.py @@ -1,3 +1,8 @@ from django.shortcuts import render # Create your views here. +from django.http import HttpResponse + + +def index(request): + return HttpResponse("Hello, world. You're at the input form")