# Path: db_file_storage/storage.py
# class FixedModelDatabaseFileStorage(DatabaseFileStorage):
#     """File storage system that saves files in the database.
# 
#     Intended for use without Models' FileFields, e.g. with Form Wizards.
#     Uses a fixed Model to store the all the saved files.
#     """
# 
#     def __init__(self, *args, **kwargs):
#         try:
#             self.model_class_path = kwargs.pop('model_class_path')
#             self.content_field = kwargs.pop('content_field')
#             self.filename_field = kwargs.pop('filename_field')
#             self.mimetype_field = kwargs.pop('mimetype_field')
#         except KeyError:
#             raise KeyError(
#                 "keyword args 'model_class_path', 'content_field', "
#                 "'filename_field' and 'mimetype_field' are required."
#             )
#         super(FixedModelDatabaseFileStorage, self).__init__(*args, **kwargs)
# 
#     def _get_storage_attributes(self, name):
#         return {
#             'model_class_path': self.model_class_path,
#             'content_field': self.content_field,
#             'filename_field': self.filename_field,
#             'mimetype_field': self.mimetype_field,
#             'filename': name,
#         }
# 
# Path: demo_and_tests/form_wizard_example/forms.py
# class SongLyricsForm1(forms.Form):
#     song = forms.CharField(max_length=100)
#     artist = forms.CharField(max_length=100)
# 
# class SongLyricsForm2(forms.Form):
#     attachment = forms.FileField(label='Lyrics', help_text='a plain text file')
# 
# class SongLyricsForm3(forms.Form):
#     sender = forms.CharField(max_length=100)


import sys
from django.shortcuts import render
from db_file_storage.storage import FixedModelDatabaseFileStorage
from formtools.wizard.views import SessionWizardView
from .forms import SongLyricsForm1, SongLyricsForm2, SongLyricsForm3
# python
# django
# third party
# project


class SongLyricsWizard(SessionWizardView):
    file_storage = FixedModelDatabaseFileStorage(
        model_class_path='form_wizard_example.FormWizardTempFile',
        content_field='content',
        filename_field='name',
        mimetype_field='mimetype'
    )

# Path: db_file_storage/storage.py
# class FixedModelDatabaseFileStorage(DatabaseFileStorage):
#     """File storage system that saves files in the database.
# 
#     Intended for use without Models' FileFields, e.g. with Form Wizards.
#     Uses a fixed Model to store the all the saved files.
#     """
# 
#     def __init__(self, *args, **kwargs):
#         try:
#             self.model_class_path = kwargs.pop('model_class_path')
#             self.content_field = kwargs.pop('content_field')
#             self.filename_field = kwargs.pop('filename_field')
#             self.mimetype_field = kwargs.pop('mimetype_field')
#         except KeyError:
#             raise KeyError(
#                 "keyword args 'model_class_path', 'content_field', "
#                 "'filename_field' and 'mimetype_field' are required."
#             )
#         super(FixedModelDatabaseFileStorage, self).__init__(*args, **kwargs)
# 
#     def _get_storage_attributes(self, name):
#         return {
#             'model_class_path': self.model_class_path,
#             'content_field': self.content_field,
#             'filename_field': self.filename_field,
#             'mimetype_field': self.mimetype_field,
#             'filename': name,
#         }
# 
# Path: demo_and_tests/form_wizard_example/forms.py
# class SongLyricsForm1(forms.Form):
#     song = forms.CharField(max_length=100)
#     artist = forms.CharField(max_length=100)
# 
# class SongLyricsForm2(forms.Form):
#     attachment = forms.FileField(label='Lyrics', help_text='a plain text file')
# 
# class SongLyricsForm3(forms.Form):
#     sender = forms.CharField(max_length=100)


# Path: demo_and_tests/form_wizard_example/views.py
import sys
from django.shortcuts import render
from db_file_storage.storage import FixedModelDatabaseFileStorage
from formtools.wizard.views import SessionWizardView
from .forms import SongLyricsForm1, SongLyricsForm2, SongLyricsForm3

# python
# django
# third party
# project


class SongLyricsWizard(SessionWizardView):
    file_storage = FixedModelDatabaseFileStorage(
        model_class_path='form_wizard_example.FormWizardTempFile',
        content_field='content',
        filename_field='name',
        mimetype_field='mimetype'
    )

    form_list = [SongLyricsForm1, SongLyricsForm2, SongLyricsForm3]