# showing the data in textarea for printing the items

**URL:** <https://forum.djangoproject.com/t/showing-the-data-in-textarea-for-printing-the-items/2803>\
**Category:** Using Django\
**Created:** [June 4, 2020, 1:35pm UTC](https://forum.djangoproject.com/t/showing-the-data-in-textarea-for-printing-the-items/2803 "2020-06-04T13:35:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali78692](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Ali78692](https://forum.djangoproject.com/u/Ali78692)\
**Post date:** [June 4, 2020, 1:35pm UTC](https://forum.djangoproject.com/t/showing-the-data-in-textarea-for-printing-the-items/2803/1 "2020-06-04T13:35:57Z")

</div>

![task](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/4/44bfec50b7246c5fd3cfe20408d353374b83563c.jpeg)  
here as shown in the above picture when i fill the fields (restau\_name , veg\_name, price, quantity) and click to save, the data should be shown in the below area and i should print the whole entries how i can do this ? please show me a path! thanks in advance

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 4, 2020, 1:56pm UTC](https://forum.djangoproject.com/t/showing-the-data-in-textarea-for-printing-the-items/2803/2 "2020-06-04T13:56:40Z")

</div>

Have you worked your way through the [Django Tutorial](https://docs.djangoproject.com/en/3.0/intro/tutorial01/) yet?

If not, that’s your best place to start. Because once you’ve completed it, you’ll have seen how to accept input from forms, how to save data in models, and how to display that data back on a page. You’ll have also created templates showing how do start doing layouts.

---

<div class="post-metadata">

**Author:** ![Ali78692](https://avatars.discourse-cdn.com/v4/letter/a/8e7dd6/32.png) [@Ali78692](https://forum.djangoproject.com/u/Ali78692)\
**Post date:** [June 4, 2020, 2:30pm UTC](https://forum.djangoproject.com/t/showing-the-data-in-textarea-for-printing-the-items/2803/3 "2020-06-04T14:30:26Z")

</div>

till now i have done this my views.py

```
from django.views.generic import ListView
from django.views.generic.edit import CreateView 
from .models import Bill

class HomePageView(ListView):
    model = Bill
    template_name = 'bill_list.html'

class NewBillPageView(CreateView):
    model = Bill
    fields = ['restau_name', 'veg_name', 'price', 'quantity']
    template_name = 'bill_new.html'
    success_url = '/'

```

my models.py are as below

```
from django.db import models
from django.conf import settings

class Bill(models.Model):
    restau_name = models.CharField(max_length=200)
    veg_name = models.CharField(max_length=200)
    price = models.IntegerField()
    quantity = models.IntegerField()
    date = models.DateTimeField(auto_now_add=True)

    def __str__ (self):
        return (self.restau_name)

```

And here is my template as bill\_list.html

```
{% extends 'base.html' %}
{% block title %}Bills{% endblock title %}
{% block content %}
 {% for bill in object_list %} 
 <div class="card"> 
 	<div class="card-header"> 
 		<span class="font-weight-bold">{{ bill.restau_name }}</span> &middot; 
 		<span class="text-muted">{{ bill.date }}</span> 
 	</div> 
 	<div class="card-body"> {{ bill.veg_name }} </div>	
 </div> 
	   <br /> 
	   <!-- <li>{{ bill }}</li> -->
 	{% endfor %} 
 {% endblock content %}

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/5/506ee20df98ce8614493d50e011068e060220ca5.png)

as you can see i have retreived the data from database.  
Thanks for your reply

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [June 4, 2020, 2:32pm UTC](https://forum.djangoproject.com/t/showing-the-data-in-textarea-for-printing-the-items/2803/4 "2020-06-04T14:32:39Z")

</div>

Great! Glad to see you’ve got it working.

Ken
