Commit bc23913a authored by Calum Mackervoy's avatar Calum Mackervoy

updated README to include changes

parent 535df6aa
Pipeline #7292 passed with stage
in 1 minute and 17 seconds
......@@ -146,6 +146,27 @@ To start the server, `cd` to the root of your Django project and run :
$ python3 runserver
## Using DjangoLDP
### Models
To use DjangoLDP in your models you just need to extend djangoldp.Model
It is recommended to also extend the Model's Meta class from LDPMetaMixin to inherit default settings, notably the default_permissions defined in the [Solid ACLs spec](
from djangoldp.models import Model, LDPMetaMixin
class Todo(Model):
name = models.CharField(max_length=255)
class Meta(LDPMetaMixin):
See "Custom Meta options" below to see some helpful ways you can tweak the behaviour of DjangoLDP
Your model will be automatically detected and registered with an LDPViewSet and corresponding URLs, as well as being registered with the Django admin panel. If you register your model with the admin panel manually, make sure to extend the GuardedModelAdmin so that the model is registered with [Django-Guardian object permissions](
## Custom Parameters to LDPViewSet
### lookup_field
......@@ -184,6 +205,10 @@ class MyModel(models.Model):
Now when an instance of `MyModel` is saved, its `author_user` property will be set to the current user.
## permissions
Django-Guardian is used by default to support object-level permissions. Custom permissions can be added to your model using this attribute. See the [Django-Guardian documentation]( for more information
## permissions_classes
This allows you to add permissions for anonymous, logged in user, author ... in the url:
......@@ -303,6 +328,15 @@ MIDDLEWARE = [
Notice tht it'll redirect only HTTP 200 Code.
## Extending DjangoLDP
### Testing
Packaged with DjangoLDP is a tests module, containing unit tests
You can extend these tests and add your own test cases by following the examples in the code. You can then run your tests with:
`python -m unittest tests.runner`
## License
Licence MIT
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment