Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
a4e4668
Add start of postgres porcessor
erinspace Jul 7, 2015
2da286f
Add saving info to table and more fields to document
erinspace Jul 8, 2015
2abb17f
Session close?
erinspace Jul 8, 2015
09fa215
Add types to array
erinspace Jul 8, 2015
391abbe
Make structure eveen simpler and actually add raw and normalzied docs
erinspace Jul 8, 2015
3a9885c
Save Raw Doc as json too for now
erinspace Jul 8, 2015
9426c9c
Add auto-incrementing IDs
erinspace Jul 8, 2015
ea46b83
Add test for process raw
erinspace Jul 8, 2015
a849b34
Add a bunch of files for the start of the Django rest API access to p…
erinspace Jul 8, 2015
bec2f2d
Add django models
erinspace Jul 9, 2015
0c0e28b
Add postgres db to settings
erinspace Jul 9, 2015
b573414
Update model name
erinspace Jul 9, 2015
3ef3731
Use django ORM's model instead to avoid complications down the line
erinspace Jul 9, 2015
2543859
Initial migration
erinspace Jul 9, 2015
f7b351a
Add django setup for some initialization
erinspace Jul 9, 2015
7e0b563
Make api an importable module
erinspace Jul 9, 2015
5483a7f
Mad migrations
erinspace Jul 9, 2015
eceaece
Update models to not include already added id
erinspace Jul 9, 2015
21b617b
update model query
erinspace Jul 9, 2015
ea11783
Remove old migrations
erinspace Jul 9, 2015
b0de066
Fix document query for existing documents
erinspace Jul 9, 2015
cc84e04
Update serializers
erinspace Jul 9, 2015
e72ee14
Add urls
erinspace Jul 9, 2015
5474a32
Update view to show basic json
erinspace Jul 9, 2015
a75ce71
Serializers work with correct model
erinspace Jul 9, 2015
0a0e2a0
Remove all unused imports
erinspace Jul 9, 2015
80ea4ee
Add reqs
erinspace Jul 9, 2015
86296fa
Mre reqs
erinspace Jul 9, 2015
be9d7e9
Mre reqs
erinspace Jul 9, 2015
5cbf133
Mre reqs
erinspace Jul 9, 2015
09c90ab
Add templates
erinspace Jul 10, 2015
2dc405d
Update spacing on html
erinspace Jul 10, 2015
6a885e6
Update url patterns
erinspace Jul 10, 2015
5522f5b
Parse things in the view before the template
erinspace Jul 10, 2015
8e0a291
Add prelim static files
erinspace Jul 10, 2015
2726cbb
Update models to use postgres json field compatibility
erinspace Jul 10, 2015
37737cf
Add static directory
erinspace Jul 10, 2015
449ee7a
Reconfigure static files
erinspace Jul 10, 2015
46f2280
Update view template for better structure
erinspace Jul 10, 2015
91e2d06
Add SHARE logo to header
erinspace Jul 10, 2015
88e0824
Added a few custom styles for prettyprint
erinspace Jul 10, 2015
46669d3
New prettyprint js loaded from the web
erinspace Jul 10, 2015
fe8ade4
Update urls with a nae
erinspace Jul 11, 2015
5382fae
Update templates
erinspace Jul 14, 2015
f47ef87
update the view
erinspace Jul 14, 2015
f42fea4
Add js folder
erinspace Jul 14, 2015
771d29c
Add docID to elasticsearch index
erinspace Jul 14, 2015
1938321
Add COARS headers and xdomain
erinspace Jul 14, 2015
9697189
Update view and urls for individual documents
erinspace Jul 14, 2015
01f0ec5
Update migration test
erinspace Jul 14, 2015
ca357be
Move docID to shareProperties for the frntend stuff
erinspace Jul 15, 2015
a48144f
Remove unecessary urls for views
erinspace Jul 16, 2015
5d996fe
Remove unecessary document detail view
erinspace Jul 16, 2015
ad69824
Remove templates for webview as only API access is needed
erinspace Jul 16, 2015
f7ea43f
Remove unecessary imports
erinspace Jul 16, 2015
6bc2fd9
Get rid of unecessary css and static stuff
erinspace Jul 16, 2015
6fea71f
Update settings file
erinspace Jul 16, 2015
33924ea
Add new test for docID in shareProperties for passing along to postgr…
erinspace Jul 16, 2015
8f29da2
Remove versions from postgres processing
erinspace Jul 16, 2015
141da66
Add django pgjson field to reqs, removed unused ones
erinspace Jul 16, 2015
fdd1247
Add sqlalchemy back into requirements
erinspace Jul 16, 2015
b9c9252
Remove init so that manage.py can find tests, might have to undo this…
erinspace Jul 17, 2015
22bccfd
Add simple test for view
erinspace Jul 17, 2015
4b5d6c8
Postgres processor update to save versions
erinspace Jul 20, 2015
f3106d2
Add inv task for api tests
erinspace Jul 20, 2015
81a381e
Add postgres and apitest to travis
erinspace Jul 21, 2015
f54fc43
Add pytest marker for postgres setup and teardown
erinspace Jul 21, 2015
338c904
Remove test db setup from postgres processor
erinspace Jul 21, 2015
b0f4cba
Remove undeeded format
erinspace Jul 21, 2015
2c439ef
postgres typo
erinspace Jul 21, 2015
d4d2941
Add django cors headers to reqs
erinspace Jul 21, 2015
d88930b
Fix setup and teardown for pytest
erinspace Jul 21, 2015
4d5c0c1
Add posgresql setup to o travis
erinspace Jul 21, 2015
573aaa1
Add init to api
erinspace Jul 21, 2015
25bf85c
Add test database to database setup in django settings
erinspace Jul 21, 2015
3ec857d
Remove sqlalchemy test db setup
erinspace Jul 21, 2015
cb1a063
Update settings - take off debug and allow all hosts
erinspace Jul 23, 2015
8fa7c88
Use Django to setup and create and teardown test DBs manually
erinspace Jul 23, 2015
5b600e3
Use newly configured conftest in postgres processor test
erinspace Jul 23, 2015
8682bb9
Add postgres test skip if postgres not configured
erinspace Jul 24, 2015
c032032
Take away init again to make api tests work
erinspace Jul 24, 2015
05c8940
try to debug connection error a bit
erinspace Jul 24, 2015
58084ce
Add absolute imports ala py3
erinspace Jul 24, 2015
7cb0624
testing
erinspace Jul 24, 2015
a968e64
add the psycgopg changes
erinspace Jul 24, 2015
12ad998
Move manage.py to top level
erinspace Jul 24, 2015
63f75f2
Make new manage.py import from right place
erinspace Jul 24, 2015
5e89c75
Update paths in django app to work with moved manage.py
erinspace Jul 24, 2015
b048997
Add init back into django app
erinspace Jul 24, 2015
346aa4f
Update conftest to close connections correctly
erinspace Jul 24, 2015
45258d9
Remove tests from inside django
erinspace Jul 24, 2015
746c7c5
fix conftest imports
erinspace Jul 24, 2015
f115257
Move api tests to test dir
erinspace Jul 24, 2015
d76456c
Remove apitst from tasks
erinspace Jul 24, 2015
301b141
Remove inv api test from tavis
erinspace Jul 24, 2015
ef15774
remove
erinspace Jul 24, 2015
c9bcfb8
remove os
erinspace Jul 24, 2015
1670345
Add pytest mark database setup for test
erinspace Jul 24, 2015
56704af
remove tests from main dir
erinspace Jul 24, 2015
d3bafe8
Move api test back to django
erinspace Jul 24, 2015
cf17e85
Add test database to django settings
erinspace Jul 27, 2015
aec93c0
add query by source and update detail pattern url
erinspace Jul 27, 2015
3a5e505
Add view by source and update doc detail view
erinspace Jul 27, 2015
fa50693
add django-pytest to dev requirements
erinspace Jul 27, 2015
f5ab7ea
Create scrapi database for travis
erinspace Jul 27, 2015
d6bc099
Add create scrapi database to travis not conftest
erinspace Jul 27, 2015
7bc777a
Add django pytest mark to process raw test
erinspace Jul 27, 2015
874ed26
Add api tests back to pytest to see if django can do its thing
erinspace Jul 27, 2015
62cb4f9
remove pytest marker from conftest
erinspace Jul 27, 2015
afb3980
Make this test a django test case
erinspace Jul 27, 2015
293c3aa
Remove the create db from scrapi for now
erinspace Jul 27, 2015
bb2f831
spacing
erinspace Jul 27, 2015
0191fbc
Add create scrapi database back to travis
erinspace Jul 27, 2015
6073f99
Add pytest ini file
erinspace Jul 27, 2015
1ca9882
Add django setup to postgres processor test
erinspace Jul 27, 2015
148415d
add running django tests in there just for fun
erinspace Jul 27, 2015
10b4b89
Remove scrapi test database
erinspace Jul 27, 2015
f6db608
add db config to travis
erinspace Jul 28, 2015
643c0d0
change rawdoc to postgres one
erinspace Jul 28, 2015
355c87e
change postgres raw]]
erinspace Jul 28, 2015
1f91a0e
Add test for process normalized
erinspace Jul 28, 2015
b11d6e3
Remove undeed django test run
erinspace Jul 28, 2015
185d66f
Add some more views tests
erinspace Jul 28, 2015
dc3844b
Remove uneeded pytest.ini
erinspace Jul 28, 2015
60253ed
Remove unused postgres setup from conftest
erinspace Jul 28, 2015
65b56c8
Remove psycopg2 and sqlalchemy from requirements
erinspace Jul 28, 2015
da084ab
remove more pg things from conftest
erinspace Jul 28, 2015
ab8283c
Add some fancier settings files
erinspace Jul 28, 2015
47656a4
Update settings
erinspace Jul 28, 2015
11e1b29
Update gitignore to ignore all local files
erinspace Jul 28, 2015
7fbdcda
Update gitignore to ignore all local files
erinspace Jul 28, 2015
9c42ad1
Remove local.py
erinspace Jul 28, 2015
1bf0d2b
Put gitignore back
erinspace Jul 28, 2015
ffe5c39
Update settings
erinspace Jul 28, 2015
521ef42
Add copy local.py to travis
erinspace Jul 28, 2015
956a498
Add django robots to requirements
erinspace Jul 28, 2015
e47bdd9
Add back psycopg2 for django jsonfield
erinspace Jul 28, 2015
ad611e4
REmove robots
erinspace Jul 28, 2015
21510b3
travis database default update
erinspace Jul 28, 2015
b538a65
Add some templates and static styles
erinspace Jul 28, 2015
ae40b04
Move custom css to css folder
erinspace Jul 28, 2015
2765a8c
Some comment changes
erinspace Jul 28, 2015
c3854bb
Start adding model for url logs
erinspace Jul 28, 2015
050e4ec
Remove the url log column - just adding to normalized
erinspace Jul 28, 2015
16c05c5
Add url processor to postgres processor
erinspace Jul 29, 2015
0921cc0
A few key error fixes
erinspace Jul 29, 2015
63243b7
Add invoke task to reset postgres and elasticsearch
erinspace Jul 29, 2015
66c1059
return things properly duh
erinspace Jul 29, 2015
3f88fee
Add inv alias to reset task
erinspace Jul 29, 2015
f132cd4
Merge branch 'develop' of github.com:fabianvf/scrapi into feature/url…
erinspace Jul 29, 2015
a16502f
Add actual uri to uri log
erinspace Jul 30, 2015
9d91fe3
Add post_processing flag, so we can more closely control post process…
erinspace Jul 31, 2015
1d9aae6
Update local-dist to have correct static files
erinspace Jul 31, 2015
581df5e
Move uri logging processor out of postgres processor
erinspace Aug 3, 2015
4bacb91
Change name of uri processor
erinspace Aug 3, 2015
48d3d89
Add basic processing tasks that do nothing right now
erinspace Aug 3, 2015
0c88127
update name
erinspace Aug 3, 2015
4350322
Add post log event
erinspace Aug 3, 2015
6436e77
Add inv task for process uris
erinspace Aug 4, 2015
558b853
Add celery task for process uri that does all documents
erinspace Aug 4, 2015
51be35f
Add try except for document normalized instead of the doc not existing
erinspace Aug 4, 2015
f264fb4
Remove unused os and django settings
erinspace Aug 4, 2015
5f50306
change args and kwargs for processor method
erinspace Aug 4, 2015
9db7b50
Add cross origin settings to local dist
erinspace Aug 4, 2015
8542dc0
Now specifiy source to just resolve urls in that source
erinspace Aug 4, 2015
ab02396
Massive if statement to organize source uris into common buckets
erinspace Aug 5, 2015
db8af8c
Merge branch 'develop' of github.com:fabianvf/scrapi into feature/pos…
erinspace Aug 6, 2015
733c915
Merge branch 'develop' of github.com:fabianvf/scrapi into feature/url…
erinspace Aug 6, 2015
970cae2
Update logging to be by document instead of all at once
erinspace Aug 10, 2015
73d00bc
Start breaking into smaller chunks
erinspace Aug 10, 2015
da46999
Breaking URIs into smaller groups now by source instead of all one
erinspace Aug 10, 2015
6af8a54
Fix url parsing for all different types of URIs
erinspace Aug 11, 2015
2d8b6da
Change to uritype
erinspace Aug 11, 2015
8bac575
Update uri processing processor to be more universal
erinspace Aug 11, 2015
98b2be5
Celery task for processing uris updated
erinspace Aug 11, 2015
d6d96f9
Remove unecessary args from tasks
erinspace Aug 11, 2015
318038c
Remove some comments from defaults
erinspace Aug 11, 2015
aba998f
Remove mystery newline
erinspace Aug 11, 2015
ec295a2
Map UUIDs to str instead of the whole list
erinspace Aug 11, 2015
768cd75
Merge branch 'feature/postgres_api' of https://github.com/erinspace/s…
fabianvf Aug 12, 2015
77b875c
Remove old comments
erinspace Aug 12, 2015
f380406
Add invoke apiserver task
erinspace Aug 12, 2015
1384544
Add proces one URI task that can be rate limited
erinspace Aug 12, 2015
3d851e1
Allow proper not async settings
erinspace Aug 12, 2015
89219ac
Update reset_all task to incl a confirmation
erinspace Aug 12, 2015
c44722c
Use Celery always eager setting for async control
erinspace Aug 12, 2015
86180f1
Pass around correct params to uri logging
erinspace Aug 12, 2015
6bfacb5
Merge branch 'feature/postgres_api' of github.com:fabianvf/scrapi int…
erinspace Aug 17, 2015
397af5d
Add basic scraping to uri pipeline
erinspace Aug 17, 2015
b1a3aec
Add basic scrapers for springer and science direct
erinspace Aug 17, 2015
83540d0
Move scrapers around, add more utilty
erinspace Aug 18, 2015
8c6f410
Leave things in an experimental state to get uri list
erinspace Aug 21, 2015
465a153
Merging changes
erinspace Aug 21, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ archive/*
.DS_Store

worker_manager/recent_files.txt
scrapi/settings/local.py
**/settings/local.py
celerybeat-schedule.db
records/
archive/*
Expand Down
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@ python:
services:
- cassandra
- elasticsearch
- postgres

addons:
postgresql: "9.4"

install:
- cp api/api/settings/local-travis.py api/api/settings/local.py
- pip install -r dev-requirements.txt
- pip install coveralls
- cp scrapi/settings/travis-dist.py scrapi/settings/local.py

before_script: flake8 .
before_script:
- flake8 .
- psql -c "CREATE DATABASE scrapi;" -U postgres
- python manage.py migrate

script:
- invoke provider_map
Expand Down
Empty file added api/__init__.py
Empty file.
Empty file added api/api/__init__.py
Empty file.
6 changes: 6 additions & 0 deletions api/api/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .defaults import *

try:
from .local import *
except ImportError as error:
raise ImportError("No local.py settings file found.")
121 changes: 121 additions & 0 deletions api/api/settings/defaults.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
"""
Django settings for shareregistration project.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os

from django.conf import global_settings

BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))


# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '...'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

TEMPLATE_DEBUG = True

DOMAIN = 'http://localhost:8000'

ALLOWED_HOSTS = [
'.osf.io',
'testserver'
]

# Application definition

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.contenttypes',
'django.contrib.sites',
'api.webview',
'rest_framework',
'corsheaders'
)

SITE_ID = 1

ACCOUNT_ACTIVATION_DAYS = 7

MIDDLEWARE_CLASSES = (
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'django.core.context_processors.debug',
'django.contrib.auth.context_processors.auth',
)

ROOT_URLCONF = 'api.api.urls'


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'scrapi'
}
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'EST'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATICFILES_DIRS = (
os.path.join(
os.path.dirname(__file__),
'..', # up one level from the settings directory
'static'
),
)

STATIC_ROOT = os.path.join('..', BASE_DIR, 'static')
STATIC_URL = '{}/static/'.format(DOMAIN)

TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

REST_FRAMEWORK = {
'PAGE_SIZE': 10,
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
)
}

CORS_ORIGIN_WHITELIST = (
'osf.io',
'staging.osf.io'
)
25 changes: 25 additions & 0 deletions api/api/settings/local-dist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SECRET_KEY = 'My Secret Key'

DEBUG = True

DOMAIN = 'http://localhost:8000'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'scrapi',
# 'USER': 'name',
# 'PASSWORD': 'password',
# 'HOST': '127.0.0.1',
# 'PORT': '5432'
}
}

STATIC_URL = '/static/'


CORS_ORIGIN_WHITELIST = (
'localhost:5000',
'osf.io',
'staging.osf.io'
)
6 changes: 6 additions & 0 deletions api/api/settings/local-travis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'scrapi',
}
}
64 changes: 64 additions & 0 deletions api/api/static/css/api_custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* custom navigation styles */
.navbar {
width: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 3;
}

.navbar {
background: #BBBBBB;
color: white;
border: none;
border-top: 5px solid #00B3EA;
border-radius: 0px;
}

.navbar .nav li, .navbar .nav li a, .navbar .brand:hover {
color: white;
}

.nav-list > .active > a, .nav-list > .active > a:hover {
background: #105B74;
}

.navbar .dropdown-menu li a, .navbar .dropdown-menu li {
color: #21B6E8;
}

.navbar .dropdown-menu li a:hover {
background: #EEEEEE;
color: #197D9E;
}

.pagination>.disabled>a,
.pagination>.disabled>a:hover,
.pagination>.disabled>a:focus {
cursor: not-allowed;
pointer-events: none;
}

.pager>.disabled>a,
.pager>.disabled>a:hover,
.pager>.disabled>a:focus {
pointer-events: none;
}

.pager .next {
margin-left: 10px;
}

.logo {
width: 60px;
padding-top: 5px;
padding-bottom: 5px;
}

.str, .atv {
color: #5D615B;
}

body a {
color: #20B3E4;
}
Binary file added api/api/static/img/share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions api/api/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""api URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Add an import: from blog import urls as blog_urls
2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('api.webview.urls')),
]
16 changes: 16 additions & 0 deletions api/api/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for api project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.settings")

application = get_wsgi_application()
30 changes: 30 additions & 0 deletions api/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% load staticfiles %}
<html>
<head>
<link href="{% static 'bower_components/bootstrap/dist/css/bootstrap.min.css' %}" rel="stylesheet" media="screen"/>
<link href="{% static 'css/custom.css' %}" rel="stylesheet" media="screen"/>
</head>

<body>
<div class="container">
<div class="jumbotron">
<img class="logo_jumbotron" src="{% static 'img/share.png' %}"/>

{% block header_content %}
{% endblock %}
</div>
<div class="help_information">
Questions or feedback? Contact us at <a href="mailto:share-support@osf.io">share-support@osf.io</a>
</div>
{% block content %}
{% endblock %}
</div>

<script src="{% static 'bower_components/jquery/dist/jquery.min.js' %}"></script>
<script src="{% static 'bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
<script src="{% static 'bower_components/pym.js/dist/pym.min.js' %}"></script>
<script>new pym.Child({ id: 'share_registration_iframe' });</script>
{% block javascript_bottom %}
{% endblock %}
</body>
</html>
29 changes: 29 additions & 0 deletions api/templates/rest_framework/api.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends "rest_framework/base.html" %}
{% load url from future %}
{% load rest_framework %}
{% load static %}

{% block title %}SHARE Notify{% endblock %}

{% block style %}
{% block bootstrap_theme %}
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/bootstrap.min.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/bootstrap-tweaks.css" %}"/>
{% endblock %}
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/prettify.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "rest_framework/css/default.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css/api_custom.css" %}"/>
{% endblock %}

{% block branding %}
<img class="logo" src="{% static 'img/share.png' %}"/>
{% endblock %}

{% block userlinks %}
{{ block.super }}
{% if user.is_authenticated %}
<li><a href="{% url 'get-api-key' %}">Get API Key</a></li>
{% endif %}
{% endblock %}


Empty file added api/webview/__init__.py
Empty file.
Empty file added api/webview/admin.py
Empty file.
13 changes: 13 additions & 0 deletions api/webview/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from django.db import models

from django_pgjson.fields import JsonField


class Document(models.Model):
source = models.CharField(max_length=100)
docID = models.CharField(max_length=100)

providerUpdatedDateTime = models.DateTimeField(null=True)

raw = JsonField()
normalized = JsonField()
10 changes: 10 additions & 0 deletions api/webview/serializers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from rest_framework import serializers

from api.webview.models import Document


class DocumentSerializer(serializers.ModelSerializer):

class Meta:
model = Document
fields = ('id', 'providerUpdatedDateTime', 'source', 'docID', 'raw', 'normalized')
Loading