Hello,
It would be very helpful to create forms in the model only. The
thing I miss
is a simple text in the model that would appear in the output form
exactly
on the position from the model as text e.g. in a Paragraph.
I fail to do it myself from documentation.
Example :
in models.py
class Example(models.Model):
Name =
models.CharField(max_length=100,blank=True,null=True)
# Now a field that needs no DB representation
Question_TIW =
models.TextInAParagraphField(verbose_name='Some informational
Text')
# or assign verbose_name later in view
Ans1_OKH = models.BooleanField(default=False)
Ans2_OKH = models.BooleanField(default=False)
Ans3_OKH = models.BooleanField(default=False)
in views.py
class ExampleNew(MyCreateView):
# I use model based views only
# Here Labels get added and Texts for Information get added to
the context
#
form_class = ExampleForm
in forms.py
class ExampleForm(BootstrapForm):
# class based form
# In BootstrapForm attributes are added to widgets and Tooltips
get added for Popovers
#
Meta=BootstrapMeta(Example)
#
# In BootstrapMeta widgets and renderers get assigned / I
use it this way
# endswith '_OKH' is a horizontal SelectButton with Label to
the right as DIV row
# to endswith '_TIW' I would assign a new TextInWellRenderer
:)
#
urls.py
url(r'^example/$', ExampleNew.as_view(mymodel=Example),
name='example'),
########################################
So 6 lines of code per Form (maybe 4, as I use the same view for
many models)
+ One line each Field
+ Generic code
Result should be a Form
with a Name input,
followed by the text,
followed by Select Buttons to click
followed by a submit button
/example
I think that would make forms in Django a lot easier to use and more
effective
with less work to do.
kind regards
Reiner