<s> from django . http import HttpResponse , Http404 <EOL> from django . shortcuts import redirect <EOL> from django . views . generic . base import TemplateView <EOL> from django . views . generic . edit import FormView <EOL> from contacts_import . conf import settings <EOL> class ImportBeginView ( TemplateView ) : <EOL> template_name = "<STR_LIT>" <EOL> class ImportServiceView ( FormView ) : <EOL> template_name = "<STR_LIT>" <EOL> def dispatch ( self , request , * args , ** kwargs ) : <EOL> try : <EOL> Importer = settings . CONTACTS_IMPORT_IMPORTERS [ kwargs [ "<STR_LIT>" ] ] ( ) <EOL> except KeyError : <EOL> raise Http404 ( ) <EOL> self . importer = Importer ( ) <EOL> return super ( ImportServiceView , self ) . dispatch ( request , * args , ** kwargs ) <EOL> def get_context_data ( self , ** kwargs ) : <EOL> ctx = kwargs <EOL> ctx [ "<STR_LIT>" ] = self . importer <EOL> return ctx <EOL> def get_form_class ( self ) : <EOL> return self . importer . form_class <EOL> def get_form ( self , form_class ) : <EOL> if form_class : <EOL> return super ( ImportServiceView , self ) . get_form ( form_class ) <EOL> def form_valid ( self , form ) : <EOL> self . importer . run ( form = form ) <EOL> return HttpResponse ( "<STR_LIT>" ) </s>
