@@ -42,14 +42,10 @@ the Linked Data Protocol standard. For local users it can be generated
at runtime, but for some resources which are from distant servers this
is required to be stored
Creating your first model
1. Creating your first model
==========================
1. Create your django model inside a file
sibserver/sibserver/models.py
.. note::
The container_path will be use to resolve instance iri and container iri In the future it could also be used to auto configure django router (e.g. urls.py)
Create your django model inside a file sibserver/sibserver/models.py
.. code:: python
...
...
@@ -59,10 +55,17 @@ Creating your first model
name = models.CharField(max_length=255)
deadline = models.DateTimeField()
1.1. Configure container path (optional)
.. note::
By default it will be “todos/” with an S for model called Todo
2. Add Meta class to your model
================================
Container path
--------------
Here you gonna configure the url within you'll get your container.
By default it will be “todos/” with an S for model called Todo.
.. warning::
We should define what is a container in more detail.
.. code:: python
...
...
@@ -73,8 +76,13 @@ Creating your first model
class Meta:
container_path = "/my-path/"
.. note::
The container_path will be use to resolve instance iri and container iri In the future it could also be used to auto configure django router (e.g. urls.py)
1.2. Configure field visibility (optional) : put in `serializer_fields` the list of field name you want to show.
Serialized fields
-----------------
You can configure field visibility (optional) : put in `serializer_fields` the list of field name you want to show.
.. code:: python
...
...
@@ -91,11 +99,10 @@ Creating your first model
Only ``name`` will be serialized
.. note::
At this stage you can limit access to certain fields of models using
For example, if you have a model with a related field with type
**django.contrib.auth.models.User** you don’t want to show personal
details or password hashes.
At this stage you can limit access to certain fields of models using
For example, if you have a model with a related field with type
**django.contrib.auth.models.User** you don’t want to show personal
details or password hashes.
E.g.
...
...
@@ -110,7 +117,42 @@ E.g.
parameter as an argument to LDPViewSet.urls(), and filtered if you set
the excludes= parameter.
2. Add a url in your urls.py:
auto_author
------------
This property allows to associate a model with the logged in user.