-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #799 from 18F/feature/usa-jobs-templatetag
CareersBlock for Resource Page template sections streamblock(USAJobs API)
- Loading branch information
Showing
8 changed files
with
96 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.5 on 2017-02-10 22:30 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('home', '0060_auto_20170209_2030'), | ||
('home', '0058_auto_20170210_2136'), | ||
] | ||
|
||
operations = [ | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% load wagtailcore_tags %} | ||
{% load open_jobs %} | ||
|
||
{% get_jobs %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{% load wagtailcore_tags %} | ||
<section class="slab slab--neutral slab--inline" > | ||
<div class="container"> | ||
<ul> | ||
{% for j in jobData %} | ||
<li> | ||
<h3><a href="{{ j.position_uri }}">{{ j.position_id }} , {{ j.position_title}}</a></h3> | ||
<ul class="u-padding--bottom"> | ||
<li class='t-sans'><strong>Open Period:</strong> {{ j.position_start_date }} - {{ j.position_end_date }}</li> | ||
<li class='t-sans'><strong>Who May Apply:</strong> {{ j.who_may_apply }}</li> | ||
<li class='t-sans'><strong>Grade:</strong> {{ j.job_grade }} - {{ j.low_grade }} - {{ j.high_grade }}</li> | ||
</ul> | ||
</li> | ||
{% empty %} | ||
<li class='t-sans'>There are currently no open positions available. Please check back on this page or Job Announcements on <a href='https://www.usajobs.gov/' title='USAJobs website'>USAJOBs</a> for the latest FEC Vacancy Announcements.")</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
from django import template | ||
import requests | ||
from django.conf import settings | ||
from django.conf import os | ||
import dateutil.parser | ||
|
||
register = template.Library() | ||
|
||
@register.inclusion_tag('partials/jobs.html') | ||
def get_jobs(): | ||
url = "https://data.usajobs.gov/api/Search" | ||
|
||
querystring = {"Organization":"LF00","WhoMayApply":"All"} | ||
headers = { | ||
'authorization-key': settings.USAJOBS_API_KEY, | ||
'user-agent': "[email protected]", | ||
'host': "data.usajobs.gov", | ||
'cache-control': "no-cache", | ||
} | ||
|
||
response = requests.request("GET", url, headers=headers, params=querystring) | ||
|
||
responses=response.json() | ||
|
||
jobData = [] | ||
for i in responses['SearchResult']['SearchResultItems']: | ||
x= {} | ||
x = { | ||
"position_title": i["MatchedObjectDescriptor"]["PositionTitle"] , | ||
"position_id": i["MatchedObjectDescriptor"]["PositionID"], | ||
"position_uri": i ["MatchedObjectDescriptor"]["PositionURI"], | ||
"position_start_date" : dateutil.parser.parse(i['MatchedObjectDescriptor']['PositionStartDate']), | ||
"position_end_date" : dateutil.parser.parse(i['MatchedObjectDescriptor']['PositionEndDate']), | ||
"who_may_apply" : i['MatchedObjectDescriptor']['UserArea']['Details']['WhoMayApply']['Name'], | ||
"job_grade" : i['MatchedObjectDescriptor']['JobGrade'][0]['Code'], | ||
"low_grade" : i['MatchedObjectDescriptor']['UserArea']['Details']['LowGrade'], | ||
"high_grade" : i['MatchedObjectDescriptor']['UserArea']['Details']['HighGrade'] } | ||
jobData.append(x) | ||
|
||
return ({'jobData':jobData}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters