title: If jinja markup is in string format, how do I use it in django and jinja2?
body: <p><a href="https://stackoverflow.com/questions/28654923/how-to-get-an-associated-model-via-a-custom-admin-action-in-django">Part 1</a> of this question asked and answered separately.</p>
  
  <p>I have a <code>Report</code> and a <code>ReportTemplate</code>. </p>
  
  <pre><code>+----+----------+---------------+-------------+
  | id |  title   |     data      | template_id |
  +----+----------+---------------+-------------+
  |  1 | report 1 | {data: [...]} |           1 |
  +----+----------+---------------+-------------+
  
  reports table
  
  +----+-----------+---------------+------------+
  | id |   title   |    markup     |    css     |
  +----+-----------+---------------+------------+
  |  1 | template1 | &lt;doctype!&gt;... | body {.... |
  +----+-----------+---------------+------------+
  
  templates table
  </code></pre>
  
  <p>A Report belongs to a ReportTemplate. A ReportTemplate has many Report.</p>
  
  <p>I have a custom admin action for Report in <code>admin.py</code> called <code>print_as_pdf</code></p>
  
  <pre><code>import logging
  
  logger = logging.getLogger('reports.admin')
  
  from django.contrib import admin
  
  # Register your models here.
  from reports.models import Report, ReportTemplate
  
  class ReportAdmin(admin.ModelAdmin):
      fields = ['commodity', 
      'date',
      'trade_period',
      'quantity_cutoff',
      'data',
      'template',
      'title']
  
      actions = ['print_as_pdf']
  
  def print_as_pdf(self, request, queryset):
      logger.debug('anything')
      for report in queryset:
          markup = report.template.markup
          logger.debug(markup)
      return
  print_as_pdf.short_description = 'Generate as pdf'
  </code></pre>
  
  <p>These are models:</p>
  
  <pre><code>class ReportTemplate(models.Model):
      title = models.CharField(max_length=50)
      markup = models.TextField(default = 'markup here...')
      styles = models.TextField(default = 'styles here...')
  
      # __unicode__ on Python 2
      # __str__ on Python 3
      def __unicode__(self):
          return self.title
  
  class Report(models.Model):
      title = models.CharField(max_length=50)
      commodity = models.CharField(max_length=10)
      date = models.DateTimeField('date traded')
      trade_period = models.CharField(max_length=10, default='open')
      quantity_cutoff = models.IntegerField(default=0)
      printed = models.BooleanField(default=0)
      datetime_email_sent = models.DateTimeField('date email sent', blank=True, null=True)
      data = models.TextField(default = 'data here...')
      template = models.ForeignKey(ReportTemplate)
  </code></pre>
  
  <p>What I want to do is:</p>
  
  <ol>
  <li>retrieve the associated ReportTemplate and its <code>markup</code> field value</li>
  <li>put the <code>data</code> field value of the Report through the <code>markup</code> value in 1 which is written with jinja2 markup</li>
  <li>use weasyprint and print out the data-filled markup from 2 as pdf</li>
  </ol>
  
  <p>I am stuck at step 2.</p>
  
  <p>Since the markup I have retrieved is in a string format, how do I run it through with the data I have?</p>