title: How do you pass model data to a template using Django?
body: <p>I am trying to pass data from a Django model into an HTML template using a class based view.</p>
  
  <p>urls.py</p>
  
  <pre><code>from django.urls import path
  from app import views
  
  urlpatterns = [
      path('review/', views.ReviewRecord.as_view(template_name='review.html'), name='review')
  ]
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>from django.db import models
  
  class MyModel(models.model):
      RegNumber = models.TextField(primary_key=True)
      Description = models.TextField(null=True)
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>from app.models import MyModel
  from django.views.generic import TemplateView
  
  class ReviewRecord(TemplateView)
      template_name = 'review.html'
      model = myModel
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['description'] = self.model.description
          return context
  </code></pre>
  
  <p>html</p>
  
  <pre><code>&lt;textarea readonly&gt;{{ description }}&lt;/textarea&gt;
  </code></pre>
  
  <p>The above code inserts the following into the html textarea: </p>
  
  <pre><code>&lt;django.db.models.query_utils.DeferredAttribute object at 0x0000024C449B9F88&gt;
  </code></pre>
  
  <p>I need to display the stored field data from the model, not the object data as stated above.</p>
  
  <p>I am trying to create a queryset based on a field in the model, for example, for a particular RegNumber.  Eventually I would like to retrieve several records and be able to increment through them, however I am currently just trying to get one to work. I have also tried using a DetailView using the primary key in the url, however I keep getting errors, therefore the provided example code is from what appears to be my closest attempt to my goal.</p>