Compare commits

..

No commits in common. "4e6f36048dc197a76036670f3e3a3f2ea4316bf3" and "a25c8177289b91858d791c32ad035d637af0c667" have entirely different histories.

5 changed files with 4 additions and 45 deletions

View File

@ -1,7 +0,0 @@
from django.db import models
from django.forms import ModelForm
class ProjectForm(ModelForm):
class Meta:
model = Project
fields = '__all__'

View File

@ -1,23 +0,0 @@
# Generated by Django 3.1.1 on 2020-09-22 13:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('input', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='project',
old_name='project_name',
new_name='name',
),
migrations.RenameField(
model_name='project',
old_name='project_start',
new_name='start',
),
]

View File

@ -6,4 +6,4 @@ class Project(models.Model):
start = models.DateTimeField('start date')
def __str__(self):
return self.name
return self.project_name

View File

@ -1 +0,0 @@
{{formset}}

View File

@ -1,18 +1,8 @@
from django.shortcuts import render
from django.forms import modelformset_factory
from .models import Project
# Create your views here.
# from django.http import HttpResponse
from django.http import HttpResponse
def index(request):
# return HttpResponse("Hello, world. You're at the input form")
ProjectFormSet = modelformset_factory(Project, fields='__all__')
if request.method == 'POST':
formset = ProjectFormSet(request.POST, request.FILES)
if formset.is_valid():
formset.save()
# do something.
else:
formset = ProjectFormSet()
return render(request, 'input/project.html', {'formset': formset})
return HttpResponse("Hello, world. You're at the input form")