<commit_before># -*- coding: utf-8 -*-

from django.shortcuts import get_object_or_404, redirect, render_to_response
from djobberbase.models import Job, Category, Type, JobStat, JobSearch, City
from djobberbase.postman import *
from djobberbase.conf import settings as djobberbase_settings
#from django.views.generic.list_detail import object_detail, object_list
#from django.views.generic.create_update import create_object, update_object
from django.core.context_processors import csrf
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.template import RequestContext
from djobberbase.helpers import *
from djobberbase.forms import ApplicationForm, JobForm
from django.db.models import Count
from django.http import Http404

from django.views.generic.list import ListView
from django.utils import timezone

object_detail = lambda *args,**kwargs:  None
object_list = lambda *args,**kwargs:  None
update_object =  lambda *args,**kwargs: None

class JobListView(ListView):
    model = Job
    def get_context_data(self, **kwargs):
        context = super(JobListView, self).get_context_data(**kwargs)
        context['page_type'] = 'index'
        context['paginate_by'] = djobberbase_settings.DJOBBERBASE_JOBS_PER_PAGE
        return context
    def get_queryset(self):
        return Job.active.all()

class CityListView(ListView):
    model = City
    def get_context_data(self, **kwargs):
        context = super(CityListView, self).get_context_data(**kwargs)
        context['page_type'] = 'cities'
        context['other_cities_total'] = Job.active.filter(city=None).count
        return context
    def get_queryset(self):
        return City.objects.all()

def job_detail(request, job_id, joburl):
    ''' Displays an active job and its application form depending if 
        the job has online applications or not. Handles the job applications
        and sends notifications emails.
    '''
    try:        
        job = Job.active.get(pk=job_id, joburl=joburl)
        extra_context = {'page_type':'detail', 
               'cv_extensions': djobberbase_settings.DJOBBERBASE_CV_EXTENSIONS,
               'markup_lang': djobberbase_settings.DJOBBERBASE_MARKUP_LANGUAGE}

        # Increment views
        job.increment_view_count(request)

        # Gets poster ip
        ip = getIP(request)

        # Only if the job has online applications ON and application 
        # notifications are activated can the user apply online
        mb = minutes_between()<commit_msg>add JobCreateView<commit_after># -*- coding: utf-8 -*-

from django.shortcuts import get_object_or_404, redirect, render_to_response
from djobberbase.models import Job, Category, Type, JobStat, JobSearch, City
from djobberbase.postman import *
from djobberbase.conf import settings as djobberbase_settings
#from django.views.generic.list_detail import object_detail, object_list
#from django.views.generic.create_update import create_object, update_object
from django.core.context_processors import csrf
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.template import RequestContext
from djobberbase.helpers import *
from djobberbase.forms import ApplicationForm, JobForm
from django.db.models import Count
from django.http import Http404

from django.views.generic.list import ListView
from django.views.generic.edit import CreateView
from django.utils import timezone

if djobberbase_settings.DJOBBERBASE_CAPTCHA_POST == 'simple':
    from djobberbase.forms import CaptchaJobForm
    _form_class = CaptchaJobForm
else:
    from djobberbase.forms import JobForm
    _form_class = JobForm

object_detail = lambda *args,**kwargs:  None
object_list = lambda *args,**kwargs:  None
update_object =  lambda *args,**kwargs: None

class JobListView(ListView):
    model = Job
    def get_context_data(self, **kwargs):
        context = super(JobListView, self).get_context_data(**kwargs)
        context['page_type'] = 'index'
        context['paginate_by'] = djobberbase_settings.DJOBBERBASE_JOBS_PER_PAGE
        return context
    def get_queryset(self):
        return Job.active.all()

class CityListView(ListView):
    model = City
    def get_context_data(self, **kwargs):
        context = super(CityListView, self).get_context_data(**kwargs)
        context['page_type'] = 'cities'
        context['other_cities_total'] = Job.active.filter(city=None).count
        return context
    def get_queryset(self):
        return City.objects.all()

class JobCreateView(CreateView):
    model = Job
    form_class = _form_class
    success_url = '../'+djobberbase_settings.DJOBBERBASE_VERIFY_URL+'/%(id)d/%(auth)s/'

def job_detail(request, job_id, joburl):
    ''' Displays an active job and its application form depending if 
        the job has online applications or not. Handles the job applications
        and sends notifications emails.
    '''
    try:        
        job = Job.active.get(pk=job_id, joburl=joburl)
        extra_context = {'page_type':'detail', 
               'cv_extensions': djobberbase_settings.DJOBBERBASE_CV_EXTENSIONS,
               'markup_lang': djobberbase_settings.DJOBBERBASE_MARKUP_LANGUAGE}

        # Increment views
        job.increment_view_count(request)

        # Gets poster ip
        ip = getIP(request)

        # Only if the job has online applications ON and application 
        # notifications are activated can the user apply online
        mb = minutes_between()
{'fraction_non_alphanumeric': 0.0815622161671208, 'fraction_numerical': 0.0025431425976385103, 'mean_word_length': 3.868258178603006, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5132499', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1557, 'n_words': 422}