hi Reiner I think what you want to do is controlled in the view not the model.
in your view do something like this:
context = {'form':form, 'infotext': "some informational text"}
return render(request,'form.html', context)
then in your template you can refer to it as follows:
{{form.name}}
{{ infotext}}
{{form.Ans1_OKH}}
{{form.Ans2_OKH}}
{{form.Ans3_OKH}}
hope that helps ...
On Monday, June 1, 2015 at 7:03:14 AM UTC-4, wigm...@gmail.com wrote:
-- in your view do something like this:
context = {'form':form, 'infotext': "some informational text"}
return render(request,'form.html', context)
then in your template you can refer to it as follows:
{{form.name}}
{{ infotext}}
{{form.Ans1_OKH}}
{{form.Ans2_OKH}}
{{form.Ans3_OKH}}
hope that helps ...
On Monday, June 1, 2015 at 7:03:14 AM UTC-4, wigm...@gmail.com wrote:
Hello all,
how can I add a string in the model that would appear in the output form exactly
on the position from the model as text e.g. in a Paragraph. Is it possible to
create a non DB related Field in models for that?
Example how I would like it to be :
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)
Result should be a Form
with a Name input,
followed by 'Some informational Text',
followed by Select Buttons to click
followed by a submit button
kind regards
Reiner
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4f0783a8-62bf-4e41-95e6-d54751016eb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment