<s> from django . utils import six <EOL> from django . core . exceptions import ImproperlyConfigured <EOL> from django_mongoengine . utils . wrappers import WrapDocument , copy_class <EOL> from django_mongoengine . utils . monkey import get_patched_django_module <EOL> from django_mongoengine . forms . documents import documentform_factory <EOL> from . detail import SingleObjectMixin , SingleObjectTemplateResponseMixin <EOL> djmod = get_patched_django_module ( <EOL> "<STR_LIT>" , <EOL> model_forms = get_patched_django_module ( <EOL> "<STR_LIT>" , modelform_factory = documentform_factory , <EOL> ) <EOL> ) <EOL> class WrapDocumentForm ( WrapDocument , djmod . FormMixinBase ) : <EOL> pass <EOL> class DocumentFormFixin ( SingleObjectMixin ) : <EOL> def get_success_url ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . success_url : <EOL> url = self . success_url . format ( ** self . object . _data ) <EOL> else : <EOL> try : <EOL> url = self . object . get_absolute_url ( ) <EOL> except AttributeError : <EOL> raise ImproperlyConfigured ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> return url <EOL> @ copy_class ( djmod . CreateView ) <EOL> class CreateView ( six . with_metaclass ( <EOL> WrapDocumentForm , <EOL> SingleObjectTemplateResponseMixin , <EOL> DocumentFormFixin , <EOL> djmod . BaseCreateView ) ) : <EOL> __doc__ = djmod . CreateView . __doc__ <EOL> @ copy_class ( djmod . UpdateView ) <EOL> class UpdateView ( six . with_metaclass ( <EOL> WrapDocumentForm , <EOL> SingleObjectTemplateResponseMixin , <EOL> DocumentFormFixin , <EOL> djmod . BaseUpdateView ) ) : <EOL> __doc__ = djmod . UpdateView . __doc__ <EOL> @ copy_class ( djmod . DeleteView ) <EOL> class DeleteView ( six . with_metaclass ( <EOL> WrapDocumentForm , <EOL> SingleObjectTemplateResponseMixin , <EOL> DocumentFormFixin , <EOL> djmod . BaseDeleteView ) ) : <EOL> __doc__ = djmod . DeleteView . __doc__ </s>
