I want to ask a question, I'm trying to upload a PDF file, in django, and I wanted to know if you how do I view this pdf, I have the following code:
models.py
class Edital(models.Model):
# ...
class DataFile(models.Model):
Arquivo = models.FileField()
def chage_view(self):
return self.Arquivo
class Meta:
verbose_name_plural = 'Editais'
Numero = models.CharField(primary_key=True, max_length= 15)
pro_reitoria = models.ForeignKey('Pro_reitoria', default="")
Arquivo = models.FileField(upload_to= "", default="")
def __str__(self):
return self.Numero
settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
In my admin, so the file
WhenIclickontheloadedfile,PagenotFound(404)
How do I get the PDF to view? Thank you for helping me!