-
Notifications
You must be signed in to change notification settings - Fork 0
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 #13 from stephengtuggy/development
Merge latest changes from development into master in preparation for a release
- Loading branch information
Showing
13 changed files
with
205 additions
and
73 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default_app_config = 'jobHistory.apps.JobHistoryConfig' |
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,8 @@ | ||
from django.urls import path | ||
from .views import IndexView | ||
|
||
app_name = 'jobHistory' | ||
|
||
urlpatterns = [ | ||
path('', IndexView.as_view(), name='index'), | ||
] |
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 |
---|---|---|
@@ -1,3 +1,16 @@ | ||
import operator | ||
|
||
from django.contrib.auth.mixins import LoginRequiredMixin | ||
from django.shortcuts import render | ||
from django.views import generic | ||
|
||
from .models import JobTimePeriod | ||
|
||
# Create your views here. | ||
class IndexView(LoginRequiredMixin, generic.ListView): | ||
template_name = 'jobHistory/index.html' | ||
context_object_name = 'chronological_job_list' | ||
|
||
def get_queryset(self): | ||
job_time_periods = JobTimePeriod.objects.all() | ||
return sorted(job_time_periods, key=operator.attrgetter('endDate'), reverse=True) |
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,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>{% block title %}{% endblock %}</title> | ||
</head> | ||
<body> | ||
<div id="header-block"> | ||
{% if user.is_authenticated %} | ||
<p>Welcome, {{ user.username }}. <a href="{% url 'admin:index' %}">Enter data</a>. <a href="{% url 'jobHistory:index' %}">View job history</a>. <a href="{% url 'logout' %}">Log out</a>.</p> | ||
{% else %} | ||
<p>Please <a href="{% url 'login' %}">log in</a>.</p> | ||
{% endif %} | ||
</div> | ||
<div id="content-block"> | ||
{% block content %} | ||
{% endblock %} | ||
</div> | ||
</body> | ||
</html> |
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,9 @@ | ||
{% extends "base/base.html" %} | ||
|
||
{% block title %}Your Job History{% endblock %} | ||
|
||
{% block content %} | ||
{% for job_time_period in chronological_job_list %} | ||
<p>{{ job_time_period }}</p> | ||
{% endfor %} | ||
{% endblock %} |
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,40 @@ | ||
{% extends "base/base.html" %} | ||
|
||
{% block title %}Login{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% if form.errors %} | ||
<p>Your username and password didn't match. Please try again.</p> | ||
{% endif %} | ||
|
||
{% if next %} | ||
{% if user.is_authenticated %} | ||
<p>Your account doesn't have access to this page. To proceed, | ||
please login with an account that has access.</p> | ||
{% else %} | ||
<p>Please login to see this page.</p> | ||
{% endif %} | ||
{% endif %} | ||
|
||
<form method="post" action="{% url 'login' %}"> | ||
{% csrf_token %} | ||
<table> | ||
<tr> | ||
<td>{{ form.username.label_tag }}</td> | ||
<td>{{ form.username }}</td> | ||
</tr> | ||
<tr> | ||
<td>{{ form.password.label_tag }}</td> | ||
<td>{{ form.password }}</td> | ||
</tr> | ||
</table> | ||
|
||
<input type="submit" value="login"> | ||
<input type="hidden" name="next" value="{{ next }}"> | ||
</form> | ||
|
||
{# Assumes you setup the password_reset view in your URLconf #} | ||
{% comment %} <p><a href="{% url 'password_reset' %}">Lost password?</a></p> {% endcomment %} | ||
|
||
{% endblock %} |
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,50 @@ | ||
version: "3.7" | ||
services: | ||
web: | ||
build: ./app | ||
container_name: | ||
job_history_web | ||
environment: | ||
- JOB_HISTORY_SECRET_KEY | ||
- JOB_HISTORY_DEBUG | ||
- JOB_HISTORY_ALLOWED_HOSTS | ||
- JOB_HISTORY_DB_NAME | ||
- JOB_HISTORY_DB_USERNAME | ||
- JOB_HISTORY_DB_PASSWORD | ||
- JOB_HISTORY_DB_HOST | ||
- JOB_HISTORY_DB_PORT | ||
- JOB_HISTORY_STATIC_ROOT | ||
- JOB_HISTORY_STATIC_URL | ||
command: | ||
/usr/src/app/manage.py test | ||
depends_on: | ||
- db | ||
ports: | ||
- "8000:8000" | ||
networks: | ||
- job_history_net_1 | ||
restart: | ||
"no" | ||
db: | ||
image: | ||
mdillon/postgis:11 | ||
container_name: | ||
job_history_db | ||
environment: | ||
- POSTGRES_USER | ||
- POSTGRES_PASSWORD | ||
- POSTGRES_DB | ||
volumes: | ||
- "pg_data:/var/lib/postgresql/data" | ||
ports: | ||
- "5432:5432" | ||
networks: | ||
- job_history_net_1 | ||
restart: | ||
"no" | ||
|
||
networks: | ||
job_history_net_1: | ||
|
||
volumes: | ||
pg_data: |