Skip to content

Commit

Permalink
Merge pull request RockefellerArchiveCenter#196 from RockefellerArchi…
Browse files Browse the repository at this point in the history
…veCenter/development

Merge development
  • Loading branch information
helrond authored Jul 7, 2022
2 parents 68b5060 + 011c2a1 commit 3370d57
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 75 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5
rev: v1.6.0
hooks:
- id: autopep8
args:
- --in-place
- --aggressive
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: git://github.com/doublify/pre-commit-isort
rev: v4.3.0
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/jazzband/pip-tools
rev: 6.2.0
rev: 6.5.1
hooks:
- id: pip-compile
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dist: bionic
language: python
python: "3.10"
cache:
directories:
- $HOME/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6
FROM python:3.10

ENV PYTHONUNBUFFERED 1
RUN mkdir /code
Expand Down
32 changes: 32 additions & 0 deletions api_formatter/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,35 @@ html {
background-color: #f7f7f9;
border: 1px solid #e1e1e8;
}

/* improve color contrast */
a {
color: #0069d9;
}

.breadcrumb-item.active {
color: #616A70;
}

.page-link {
color: #0069d9;
}

.btn-primary, .page-item.active {
background-color: #0069d9;
border-color: #0069d9;
}

.btn-primary:hover, .btn-outline-primary:hover {
background-color: #004FA3;
border-color: #004FA3;
}

.btn-outline-primary {
border-color: #0069d9;
color: #0069d9;
}

.nav-link:hover, .page-link:hover {
text-decoration: underline;
}
33 changes: 20 additions & 13 deletions api_formatter/templates/rest_framework/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,26 @@
{% block title %}{% if name %}{{ name }} – {% endif %}RAC API{% endblock %}

{% block navbar %}
<div class="navbar navbar-static-top navbar-expand navbar-dark bg-dark mb-3"
role="navigation" aria-label="{% trans "navbar" %}">
<div class="container">
{% block branding %}
<a class="navbar-brand" rel="nofollow" href="/">RAC API</a>
{% endblock %}
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="{% url 'agent-list' %}">Agents</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'collection-list' %}">Collections</a></li>
<li class="nav-item"><a class="nav-link" href="{% url 'object-list' %}">Objects</a></li>
</ul>
</div>
</div>
<header class="main-header">
<nav class="navbar navbar-expand-sm navbar-dark bg-dark mb-5" role="navigation" aria-label="{% trans "navbar" %}">
<div class="container">
<a class="navbar-brand" href="/">RAC API</a>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link text-light" href="{% url 'agent-list' %}">Agents</a></li>
<li class="nav-item"><a class="nav-link text-light" href="{% url 'collection-list' %}">Collections</a></li>
<li class="nav-item"><a class="nav-link text-light" href="{% url 'object-list' %}">Objects</a></li>
<li class="nav-item"><a class="nav-link text-light" href="https://docs.rockarch.org/argo">Documentation</a></li>
</ul>
</div>
</div>
</nav>
</header>
{% endblock %}

{% block breadcrumbs %}
Expand Down
3 changes: 2 additions & 1 deletion api_formatter/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
import random

from argo import settings
from django.test import TestCase
from django.urls import reverse
from elasticsearch.helpers import streaming_bulk
Expand All @@ -13,6 +12,8 @@
from rac_schemas import is_valid
from rest_framework.test import APIRequestFactory

from argo import settings

from .view_helpers import date_string
from .views import (AgentViewSet, CollectionViewSet, MyListView, ObjectViewSet,
SearchView, TermViewSet)
Expand Down
8 changes: 4 additions & 4 deletions api_formatter/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import include, url
from django.urls import include, re_path
from rest_framework.schemas import get_schema_view

from .routers import RACRouter
Expand All @@ -20,7 +20,7 @@
)

urlpatterns = [
url(r'^', include(router.urls)),
url(r'facets', FacetView.as_view({'get': 'retrieve'}), name='facets'),
url(r'^schema', schema_view, name='schema'),
re_path(r'^', include(router.urls)),
re_path(r'facets', FacetView.as_view({'get': 'retrieve'}), name='facets'),
re_path(r'^schema', schema_view, name='schema'),
]
12 changes: 6 additions & 6 deletions api_formatter/view_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from argo import settings
from django.http import Http404
from django_elasticsearch_dsl_drf.constants import (LOOKUP_FILTER_PREFIX,
LOOKUP_FILTER_RANGE,
Expand All @@ -10,15 +9,16 @@
LOOKUP_QUERY_IN,
LOOKUP_QUERY_LT,
LOOKUP_QUERY_LTE)
from django_elasticsearch_dsl_drf.filter_backends import (DefaultOrderingFilterBackend,
FilteringFilterBackend,
NestedFilteringFilterBackend,
OrderingFilterBackend,
SuggesterFilterBackend)
from django_elasticsearch_dsl_drf.filter_backends import (
DefaultOrderingFilterBackend, FilteringFilterBackend,
NestedFilteringFilterBackend, OrderingFilterBackend,
SuggesterFilterBackend)
from django_elasticsearch_dsl_drf.pagination import LimitOffsetPagination
from elasticsearch_dsl import Index, Search, connections
from rest_framework.viewsets import ReadOnlyModelViewSet

from argo import settings

STRING_LOOKUPS = [
LOOKUP_FILTER_TERMS,
LOOKUP_FILTER_PREFIX,
Expand Down
3 changes: 2 additions & 1 deletion api_formatter/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from argo import settings
from django.http import Http404
from django_elasticsearch_dsl_drf.constants import SUGGESTER_TERM
from django_elasticsearch_dsl_drf.pagination import LimitOffsetPagination
Expand All @@ -11,6 +10,8 @@
from rest_framework.views import APIView
from rest_framework.viewsets import ReadOnlyModelViewSet

from argo import settings

from .pagination import CollapseLimitOffsetPagination
from .serializers import (AgentListSerializer, AgentSerializer,
AncestorsSerializer, CollectionHitSerializer,
Expand Down
3 changes: 2 additions & 1 deletion argo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from api_formatter.views import MyListView
from django.contrib import admin
from django.urls import include, path

from api_formatter.views import MyListView

urlpatterns = [
path('admin/', admin.site.urls),
path('mylist', MyListView.as_view(), name='mylist'),
Expand Down
22 changes: 11 additions & 11 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Django==3.2.11
django-cors-headers==3.10.0
django-elasticsearch-dsl==7.2.1
django-elasticsearch-dsl-drf==0.22.2
djangorestframework==3.12.4
elasticsearch==7.15.2
Django==4.0.5
django-cors-headers==3.12.0
django-elasticsearch-dsl==7.2.2
django-elasticsearch-dsl-drf==0.22.4
djangorestframework==3.13.1
elasticsearch==7.17.0
elasticsearch-dsl==7.4.0
jsonschema==3.2.0
psycopg2-binary==2.9.1
jsonschema==4.4.0
psycopg2-binary==2.9.3
PyYAML==6.0
rac-schemas==0.29
rac_es==0.17.3
shortuuid==1.0.1
rac-schemas==0.30
rac_es==0.18
shortuuid==1.0.9
uritemplate==4.1.1
50 changes: 19 additions & 31 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#
# This file is autogenerated by pip-compile with python 3.6
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile
#
asgiref==3.4.1
asgiref==3.5.2
# via django
attrs==21.2.0
attrs==21.4.0
# via jsonschema
certifi==2021.10.8
certifi==2022.5.18.1
# via elasticsearch
django==3.2.11
django==4.0.5
# via
# -r requirements.in
# django-cors-headers
# django-nine
# djangorestframework
django-cors-headers==3.10.0
django-cors-headers==3.12.0
# via -r requirements.in
django-elasticsearch-dsl==7.2.1
django-elasticsearch-dsl==7.2.2
# via
# -r requirements.in
# django-elasticsearch-dsl-drf
django-elasticsearch-dsl-drf==0.22.2
django-elasticsearch-dsl-drf==0.22.4
# via -r requirements.in
django-nine==0.2.5
# via django-elasticsearch-dsl-drf
djangorestframework==3.12.4
djangorestframework==3.13.1
# via
# -r requirements.in
# django-elasticsearch-dsl-drf
elasticsearch==7.15.2
elasticsearch==7.17.0
# via
# -r requirements.in
# django-elasticsearch-dsl-drf
Expand All @@ -42,47 +42,35 @@ elasticsearch-dsl==7.4.0
# django-elasticsearch-dsl
# django-elasticsearch-dsl-drf
# rac-es
importlib-metadata==4.8.2
# via jsonschema
jsonschema==3.2.0
jsonschema==4.4.0
# via
# -r requirements.in
# rac-schemas
psycopg2-binary==2.9.1
psycopg2-binary==2.9.3
# via -r requirements.in
pyrsistent==0.18.0
pyrsistent==0.18.1
# via jsonschema
python-dateutil==2.8.2
# via elasticsearch-dsl
pytz==2021.3
# via django
pytz==2022.1
# via djangorestframework
pyyaml==6.0
# via -r requirements.in
rac_es==0.17.3
rac-es==0.18
# via -r requirements.in
rac-schemas==0.29
rac-schemas==0.30
# via -r requirements.in
shortuuid==1.0.1
shortuuid==1.0.9
# via -r requirements.in
six==1.16.0
# via
# django-elasticsearch-dsl
# django-elasticsearch-dsl-drf
# elasticsearch-dsl
# jsonschema
# python-dateutil
sqlparse==0.4.2
# via django
typing-extensions==4.0.1
# via
# asgiref
# importlib-metadata
uritemplate==4.1.1
# via -r requirements.in
urllib3==1.26.7
urllib3==1.26.9
# via elasticsearch
zipp==3.6.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools

0 comments on commit 3370d57

Please sign in to comment.