Renamed app to avoid confusion with django forms

This commit is contained in:
David Taylor
2015-08-05 19:00:19 +03:00
committed by Tom Price
parent eb41636ffc
commit f99e16f562
9 changed files with 82 additions and 5 deletions

20
rigForms/views.py Normal file
View File

@@ -0,0 +1,20 @@
from django.shortcuts import render
from django.views import generic
from rigForms import models
class FormCreate(generic.CreateView):
model = models.Form
fields = ['data']
"""
Expects kwarg "type_pk" to contain PK of required type
"""
def get_context_data(self, **kwargs):
context = super(FormCreate, self).get_context_data(**kwargs)
schemaType = get_object_or_404(models.Type,kwargs["type_pk"])
currentSchema = models.Schema.objects.current_schema(schemaType)
context["type"] = schemaType
context["schema"] = currentSchema
return context