#NEWLINE# def job_detail( request , job_id , joburl ) : #NEWLINE# #INDENT# ' Displays an active job and its application form depending if \n        the job has online applications or not. Handles the job applications\n        and sends notifications emails.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# job = Job . active . get ( pk = job_id , joburl = joburl ) #NEWLINE# extra_context = { #NEWLINE# #INDENT# 'page_type' : 'detail' , #NEWLINE# 'cv_extensions' : djobberbase_settings . DJOBBERBASE_CV_EXTENSIONS , #NEWLINE# 'markup_lang' : djobberbase_settings . DJOBBERBASE_MARKUP_LANGUAGE , #NEWLINE# #UNINDENT# } #NEWLINE# job . increment_view_count ( request ) #NEWLINE# ip = getIP ( request ) #NEWLINE# mb = minutes_between ( ) #NEWLINE# if ( job . apply_online and djobberbase_settings . DJOBBERBASE_APPLICATION_NOTIFICATIONS ) : #NEWLINE# #INDENT# extra_context . update ( csrf ( request ) ) #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = ApplicationForm ( request . POST , request . FILES , applicant_data = { #NEWLINE# #INDENT# 'ip' : ip , #NEWLINE# 'mb' : mb , #NEWLINE# #UNINDENT# } ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# application_mail = MailApplyOnline ( job , request ) #NEWLINE# application_mail . start ( ) #NEWLINE# ja = JobStat ( job = job , ip = ip , stat_type = 'A' ) #NEWLINE# ja . save ( ) #NEWLINE# messages . add_message ( request , messages . INFO , _ ( 'Your application was sent successfully.' ) ) #NEWLINE# extra_context [ 'page_type' ] = 'application' #NEWLINE# queryset = Job . active . filter ( joburl = joburl ) #NEWLINE# return object_detail ( request , queryset = queryset , object_id = job_id , extra_context = extra_context ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# extra_context [ 'form_error' ] = True #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = ApplicationForm ( applicant_data = { #NEWLINE# #INDENT# 'ip' : ip , #NEWLINE# 'mb' : mb , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# extra_context [ 'apform' ] = form #NEWLINE# extra_context [ 'object' ] = job #NEWLINE# return render_to_response ( 'djobberbase/job_detail.html' , extra_context , context_instance = RequestContext ( request ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# queryset = Job . active . filter ( joburl = joburl ) #NEWLINE# return object_detail ( request , queryset = queryset , object_id = application_mail , extra_context = extra_context ) #NEWLINE# #UNINDENT# #UNINDENT# except Job . DoesNotExist : #NEWLINE# #INDENT# return redirect ( 'djobberbase_job_unavailable' , permanent = True )