A
A
apheyhys2018-10-17 22:36:41
Django
apheyhys, 2018-10-17 22:36:41

Field value in views?

Please tell me there is a model

class Novel(models.Model):
    novel_txt = models.FileField(upload_to='uploads/books_txt', blank=True, null=True)

Let's say we have written the file "uploads/books_txt/book.txt"
to the database. How can I get the path (novel_txt) from which the file was written in the view?
get_file = Novel.objects.get(???)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Web Dentist, 2018-10-18
@apheyhys

get_file = Novel.objects.get(id=id) .novel_txt ????

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question