Feature request - models.TextInAParagraphField

45 views
Skip to first unread message

wigm...@gmail.com

unread,
May 30, 2015, 6:16:06 PM5/30/15
to django-d...@googlegroups.com
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

Marc Tamlyn

unread,
May 30, 2015, 6:38:44 PM5/30/15
to django-d...@googlegroups.com
Hi Reiner.

You'll get answers to questions like this on the django-users email list, <django-deve...@googlegroups.com> - the web interface is <https://groups.google.com/forum/#!forum/django-users>.

The list you've posted to is django-developers, which is for the discussion of the development of Django itself.

You might also find the #django IRC channel on irc.freenode.net helpful.

As a start point, you may also wish to read the docs for help_text.

Marc

--
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 django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
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.

Reply all
Reply to author
Forward
0 new messages