예제 #1
0
def my_cron_job():
    print("**********success*************8")
    task_url = "https://v13.teamproit.com/api/resource/Task?fields=[%22name%22,%22subject%22,%22service%22,%22territory%22,%22description%22,%22customer%22,%22project%22,%22currency%22,%22amount%22,%22amount%22,%22job_category%22,%22creation%22,%22minimum_experience%22,%22maximum_experience%22,%22qualification%22,%22specialization%22,%22salary_type%22,%22from%22,%22to%22]&&filters=[[%22service%22,%22==%22,%22REC-I%22],[%22service%22,%22==%22,%22REC-D%22],[%22status%22,%22!=%22,%22Completed%22],[%22status%22,%22!=%22,%22Cancelled%22],[%22status%22,%22!=%22,%22Hold%22]]&&limit_page_length=5000"
    response = requests.request("GET", task_url)
    byte_str = response.content
    dict_str = byte_str.decode("UTF-8")
    job_response = json.loads(dict_str)
    for j in job_response["data"]:
        a = Job(title=j["name"],
                short_description=j["subject"],
                long_description=j["territory"],
                created_by=request.user)
        a.save()
예제 #2
0
파일: admins.py 프로젝트: gmist/five-studio
def edit_job(request, key_id):
    job = Job.get_by_id(key_id)
    if not job:
        return redirect(url_for('job/admin/index'))
    form = JobForm(instance=job)
    if request.method == 'POST' and form.validate(request.form):
        job = form.save(commit=False)
        job.put()
        return redirect(url_for('job/admin/index'))
    return render_to_response(
        'job/admin/edit.html', {
            'form': form.as_widget(),
            'key_id': key_id
        }
    )
예제 #3
0
파일: admins.py 프로젝트: gmist/five-studio
def index(request):
    jobs = Job.all().order('-create_time')
    return render_to_response(
        'job/admin/index.html',{
            'jobs': jobs
        })
예제 #4
0
파일: admins.py 프로젝트: gmist/five-studio
def delete_job(request, key_id):
    job = Job.get_by_id(key_id)
    if job:
        job.delete()
    return redirect(url_for('job/admin/index'))
예제 #5
0
파일: views.py 프로젝트: gmist/five-studio
def index(request):
    jobs = Job.all().filter('is_public =', True).order('-create_time')
    return render_to_response('job/index.html', {'jobs': jobs})
예제 #6
0
파일: views.py 프로젝트: gmist/five-studio
def view_job(request, key_id):
    job = Job.get_by_id(key_id)
    if not job or job.is_public == False:
        job = None
    return render_to_response('job/view.html', {'job': job})