pavlov99 / jsonapi Goto Github PK
View Code? Open in Web Editor NEW๐ jsonapi protocol implementation for Django.
License: MIT License
๐ jsonapi protocol implementation for Django.
License: MIT License
Need to get
Resource.Meta.is_inherited is used for field definition during queries. Child model name should be used.
Currently paths to auth_user models are defined based on resources. AUTH_USER model could not be defined, it may cause security issues.
query distribution GET/POST/PUT
example: http://33.33.33.32:8000/api/author/3,5?include=posts,posts.comments
linked posts should have comments
Otherwise library raises KeyError.
Currently is_auth_user is defined on the fly from settings. Sinse this settings suppose to not be changed, define it during resource creation.
Think about tests, how is it possible to mock it. Mock settings.AUTH_USER_MODEL?
Check them out: http://en.wikipedia.org/wiki/HTTP_403
After jsonapi update, new argument "filter" was introduced. Update current library to support it.
If user does not have access to remove objects, raise error instead of remove nothing and return 204 status.
'[]', '', '[1]', '[1, 2]', '1'
For some reason django lowercases header name.
/home/vagrant/git/jsonapi/docs/jsonapi.rst:37: WARNING: autodoc: failed to import module u'jsonapi.resource'; the following exception was raised:
Traceback (most recent call last):
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 335, in import_object
import(self.modname)
File "/home/vagrant/git/jsonapi/jsonapi/resource.py", line 7, in
from django.db import models
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/init.py", line 5, in
from django.db.models.query import Q
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/query.py", line 17, in
from django.db.models.deletion import Collector
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/deletion.py", line 4, in
from django.db.models import signals, sql
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/sql/init.py", line 4, in
from django.db.models.sql.subqueries import *
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/sql/subqueries.py", line 12, in
from django.db.models.sql.query import Query
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/sql/query.py", line 22, in
from django.db.models.sql import aggregates as base_aggregates_module
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/sql/aggregates.py", line 9, in
ordinal_aggregate_field = IntegerField()
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/db/models/fields/init.py", line 116, in init
self.db_tablespace = db_tablespace or settings.DEFAULT_INDEX_TABLESPACE
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/conf/init.py", line 54, in getattr
self._setup(name)
File "/home/vagrant/git/jsonapi/.env/lib/python2.7/site-packages/django/conf/init.py", line 47, in _setup
% (desc, ENVIRONMENT_VARIABLE))
ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
django has distinct queries to query different objects. Add it to library.
It is because data in PUT request is partial and form init with model instance does not help here.
Create Partial Form Dynamically based on current available form.
Usecase: create/edit/delete model there are permissions required. Get model: no permissions.
It makes query faster.
model inspector should be able to detect through relationship correctly.
https://docs.djangoproject.com/en/1.7/ref/models/fields/#django.db.models.ManyToManyField.through
If there is the same object links to several documents, it would be duplicated in linked attribute.
If model PostWithPicture is inherited from Post, resource has "post_ptr" in links. Remove it.
Now if client sends existing field which is not in Resource.Meta.form, it is injected there with partial form.
Filter partial form fields with form fields if exist.
Otherwise one may not possible to update relation fields.
if field is included, it is property.
if property has setter, set it. If not, skip it. Anyway, remove save from form.
If there are two resources Parent and Child, and Parent model is parent for Child model, make sure that ChildResource has ParentResourceAuthenticators authenticators by default.
It prevents security issues when it is possible to access some of Parent models through parent resource.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.