<form method = "get">
{% csrf_token %}
<input type = "submit", name = "q">

views
------

formView (request):
     if request.method == "GET" and 'q' in request.method:
          ---------
         your view code
        -----------
        return render(request, template_name, context = {'text' :
*database_text,
... . ., ., , ,}*

HTML (use bootstrap if possible)
-------
<div class = "container'>
     <div class = "row">
          <div class = "col-sm4">

* Your columns for row 1         <*/div>
*          <*div class = "col-sm4">
          </div>
          <div class = "col-sm4">
          </div>
      </div>
and another row here

if you work it out on say : text = Content.objects.filter(*"your query")*

then you could loop based on this in your HTML:

{% for t in text %}
{{t.content_Content}}
{% endfor %}


Hope it helps !

regards



[image: --]

Maninder Kumar
[image: http://]about.me/maninder.s.kumar
<http://about.me/maninder.s.kumar?promo=email_sig>




On Tue, Jan 28, 2020 at 3:22 PM Suraj <dadral...@gmail.com> wrote:

> On Monday, January 20, 2020 at 11:59:01 AM UTC+5:30, nmax...@gmail.com
> wrote:
>>
>> I would like to render data from a populated database into a HTML
>> (homepage_view).  I am not sure if I create a <form> GET method from the
>> database (and if so how) or use (fix) the code listed below.
>>
>> The ultimate outcome is to have a table with three columns (models.py)
>> with six rows.  Note:  In the home.html (below), I did hardcode the headers
>> but tried a "for loop" to populate the data.
>>
>
>> I am using Python 3.8, Django 2.2, Windows 10, sqlite3 and bootstrap.
>>
>> Please any help would be truly appreciated.
>>
>
> You can use django-tables2
> <https://django-tables2.readthedocs.io/en/latest/> to create tables from
> model data.
> It is very simple by using django-tables2.
>
> --
> Suraj
> https://hacksj4u.wordpress.com
> https://github.com/SurajDadral
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e9118353-de5a-48db-a281-053c545946e2%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e9118353-de5a-48db-a281-053c545946e2%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABOHK3R7j%2BGKUmUGqA9B%2Bf%3Dy8nxsL44CshWWqGjOXUhWWmidxQ%40mail.gmail.com.

Reply via email to