Django : how to upload a file in admin
<p>I try to create a link to download a file in the admin but it does not work</p>

<p>my model</p>

<pre><code>class Event(models.Model):
    ......
    file = models.FileField(_('fichier'), upload_to='medias',  null=True,  blank=True)

    def file_(self):
        if self.file:
            return "&lt;a href='%s'&gt;download&lt;/a&gt;" % (self.file.url,)
        else:
            return "No attachment"
</code></pre>

<p>my admin :</p>

<pre><code>class EventAdmin(admin.ModelAdmin):

list_display = ('title', 'start', 'end', 'user', 'fin', 'frequency', 'file_',)


fieldsets = (
    (None, {
        'fields': ('title','start', 'end', 'is_cancelled', 'calendar', 'user', 'description', ('frequency', 'fin' ), 'activated', 'file_',)
    }),
</code></pre>

<p>I get the error :</p>

<blockquote>
  <p>Exception Value:  </p>
  
  <p>'EventAdmin.fieldsets[0][1]['fields']' refers to field 'file_' that is
  missing from the form.</p>
</blockquote>

<p>what is this problem ?</p>