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
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/4d7640ff-c064-4db5-8d3c-50b2db10e142%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.