Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
TAlone
memopol
Commits
984d8de0
Commit
984d8de0
authored
Sep 16, 2016
by
Nicolas Joyard
Browse files
Graphene API experiment
parent
407f1795
Changes
7
Hide whitespace changes
Inline
Side-by-side
memopol/settings.py
View file @
984d8de0
...
...
@@ -52,13 +52,16 @@ INSTALLED_APPS = (
'bootstrap3'
,
'datetimewidget'
,
'django_filters'
,
'django_graphiql'
,
'fontawesome'
,
'graphene.contrib.django'
,
'rest_framework'
,
'taggit'
,
# memopol apps
'core'
,
'memopol'
,
'memopol_graphene_api'
,
'memopol_scores'
,
'memopol_settings'
,
'memopol_themes'
,
...
...
memopol/urls.py
View file @
984d8de0
...
...
@@ -2,6 +2,11 @@
from
django.conf.urls
import
include
,
url
from
django.contrib
import
admin
from
django.views.decorators.csrf
import
csrf_exempt
from
graphene.contrib.django.views
import
GraphQLView
from
memopol_graphene_api.schema
import
schema
from
views.home
import
HomeView
...
...
@@ -47,6 +52,9 @@ urlpatterns = [
url
(
r
'^api/'
,
include
(
api
.
router
.
urls
)),
url
(
r
'^graphql'
,
csrf_exempt
(
GraphQLView
.
as_view
(
schema
=
schema
))),
url
(
r
'^graphiql'
,
include
(
'django_graphiql.urls'
)),
# Homepage
url
(
r
'^$'
,
HomeView
.
as_view
(),
name
=
'home'
),
...
...
memopol_graphene_api/__init__.py
0 → 100644
View file @
984d8de0
memopol_graphene_api/schema.py
0 → 100644
View file @
984d8de0
import
graphene
from
.schemas.representative
import
RepresentativeQuery
class
Query
(
RepresentativeQuery
):
pass
schema
=
graphene
.
Schema
(
name
=
'Memopol Schema'
)
schema
.
query
=
Query
memopol_graphene_api/schemas/__init__.py
0 → 100644
View file @
984d8de0
memopol_graphene_api/schemas/representative.py
0 → 100644
View file @
984d8de0
from
graphene
import
relay
,
ObjectType
from
graphene.contrib.django.filter
import
DjangoFilterConnectionField
from
graphene.contrib.django.types
import
DjangoNode
from
representatives.models
import
Representative
class
RepresentativeNode
(
DjangoNode
):
class
Meta
:
model
=
Representative
filter_fields
=
[
'full_name'
]
class
RepresentativeQuery
(
ObjectType
):
representative
=
relay
.
NodeField
(
RepresentativeNode
)
all_representatives
=
DjangoFilterConnectionField
(
RepresentativeNode
)
class
Meta
:
abstract
=
True
setup.py
View file @
984d8de0
...
...
@@ -17,12 +17,14 @@ setup(name='political-memory',
'django-datetime-widget>=0.9,<1.0'
,
'django-filter>=0.13,<0.14'
,
'django-fontawesome>=0.2,<0.3'
,
'django-graphiql>=0.4,<0.5'
,
'django-representatives-votes==0.0.24'
,
'django-representatives==0.0.35'
,
'django-rql-filter>=0.1.3,<0.2'
,
'django-taggit>=0.17,<0.18'
,
'django>=1.8,<1.9'
,
'djangorestframework>=3,<4'
,
'graphene[django]>=0.10,<1'
,
'hamlpy>=0.82,<0.83'
,
'ijson>=2.2,<2.3'
,
'python-dateutil>=2.4,<2.5'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment