title: PDF preview using embed tag with Django
body: <p>Well, I'm new on this.
  I want to know if I can display a PDF file in my Django template using embed tag like:</p>
  
  <pre><code>&lt;embed src="/file/to/pdf/some_pdf.pdf" /&gt;
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>&lt;embed src="{{form.file_path.value}}" width="500" height="525" /&gt;
  </code></pre>
  
  <p>Where {{form.file_path.value}} is my pdf file directory or name saved in the database.</p>
  
  <p>This is the <strong>forms.py</strong> file:</p>
  
  <pre><code>fields = [
              'title',
              'publication_date',
              'file_path',
              'size',
              'authors',
              'editorial',
          ]
          labels = {
              'title': 'Title',
              'publication_date': 'Publication Date',
              'file_path': 'File preview',
              'size': 'Size',
              'authors': 'Authors',
              'editorial': 'Editorial',
          }
  
          widgets = {
              'title':forms.TextInput(attrs={'class':'form-control'}),
              'publication_date':forms.TextInput(attrs={'class':'form-control'}),
              'file_path':forms.TextInput(attrs={'class':'form-control'}),
              'size':forms.TextInput(attrs={'class':'form-control'}),
              'authors': forms.CheckboxSelectMultiple(),
              'editorial': forms.Select(attrs={'class':'form-control'}),
          }
  </code></pre>
  
  <p>And this is the <strong>views.py</strong> file:</p>
  
  <pre><code>class BookList(ListView):
      model = Book
      template_name = 'book/book_list.html'
      context_object_name = 'book'
      queryset = Book.objects.prefetch_related('authors')
      paginate_by = 10
      def get_context_data(self, **kwargs):
          context = super(BookList,self).get_context_data(**kwargs)
          book_list =Book.objects.all()
          paginator = Paginator(book_list,self.paginate_by)
  
          page = self.request.GET.get('page')
          try:
              book_list = paginator.page(page)
          except PageNotAnInteger:
              file_book = paginator.page(1)
          except EmptyPage:
              book_list = paginator.page(paginator.num_pages)
  
          context['book_list'] = book_list
          return context
  </code></pre>