Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def save_lessons(self, textbook, upload_file):
- zipped_list = self.parse(upload_file)
- for tup in zipped_list:
- title = tup[0]
- text = tup[1]
- f = tempfile.NamedTemporaryFile()
- f.write(text)
- file_object = File(f)
- f.seek(0)
- lesson = Lesson(title=title, file=file_object, textbook=textbook)
- print(title)
- print(file_object)
- lesson.save()
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement