-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CareersBlock for Resource Page template sections streamblock(USAJobs API) #799
Changes from 19 commits
383ff65
6dcfe03
2b8f510
0b0c5f1
20ea464
0d034eb
1c0eea3
218c1e2
fbcb9db
388dca2
2ef91aa
5336bc8
32bec7a
c6c55b9
c02b731
271d313
9982536
3cb9078
fdd9724
8556ce1
bd3294d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 = [ | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% load wagtailcore_tags %} | ||
{% load open_jobs %} | ||
|
||
{% get_jobs %} |
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.PositionURI }}">{{ j.PositionID }} , {{ j.PositionTitle}}</a></h3> | ||
<ul class="u-padding--bottom"> | ||
<li class='t-sans'><strong>Open Period:</strong> {{ j.PositionStartDate }} - {{ j.PositionEndDate }}</li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super small thing, but prefer double quotes for attributes in HTML. Also, you can just put |
||
<li class='t-sans'><strong>Who May Apply:</strong> {{ j.WhoMayApply }}</li> | ||
<li class='t-sans'><strong>Grade:</strong> {{ j.JobGrade }} - {{ j.LowGrade }} - {{ j.HighGrade }}</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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
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 = { "PositionTitle": i["MatchedObjectDescriptor"]["PositionTitle"] , | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few small formatting things:
|
||
"PositionID": i["MatchedObjectDescriptor"]["PositionID"], "PositionURI": i ["MatchedObjectDescriptor"]["PositionURI"], | ||
"PositionStartDate" : dateutil.parser.parse(i['MatchedObjectDescriptor']['PositionStartDate']), | ||
"PositionEndDate" : dateutil.parser.parse(i['MatchedObjectDescriptor']['PositionEndDate']), | ||
"WhoMayApply" : i['MatchedObjectDescriptor']['UserArea']['Details']['WhoMayApply']['Name'], | ||
"JobGrade" : i['MatchedObjectDescriptor']['JobGrade'][0]['Code'], | ||
"LowGrade" : i['MatchedObjectDescriptor']['UserArea']['Details']['LowGrade'], | ||
"HighGrade" : i['MatchedObjectDescriptor']['UserArea']['Details']['HighGrade'] } | ||
jobData.append(x) | ||
|
||
return ({'jobData':jobData}) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to add a preference to your text editor to strip out extraneous whitespace like this. Not a big deal, but will result in fewer false diffs.