diff --git a/.gitignore b/.gitignore index c92aa38..bde1b9d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,8 @@ drfdocs.egg-info/ site/ +demo/node_modules/ +rest_framework_docs/static/rest_framework_docs/js/dist.min.js + rest_framework_docs/static/node_modules/ rest_framework_docs/static/rest_framework_docs/js/dist.min.js.map diff --git a/README.md b/README.md index 6c82768..3bfde01 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Document Web APIs made with Django Rest Framework. [View Demo](http://demo.drfdocs.com/) +> **Contributors Wanted**: Do you like this project? Using it? Let's make it better! + ![DRFdocs](https://cloud.githubusercontent.com/assets/6333409/13193861/69e82aec-d778-11e5-95c4-77f4ef29e6e5.png) ### Supports @@ -66,14 +68,14 @@ You can find detailed information about the package's settings at [the docs](htt First of all thanks to the [Django](http://www.djangoproject.com/) core team and to all the contributors of [Django REST Framework](http://www.django-rest-framework.org/) for their amazing work. Also I would like to thank [Marc Gibbons](https://github.com/marcgibbons) for his *django-rest-framework-docs* project. Both projects share the same idea, it is just that Marc's is not maintained anymore and does not support DRF 3+ & Python 3. -[travis-image]: https://travis-ci.org/ekonstantinidis/django-rest-framework-docs.svg?branch=master -[travis-url]: https://travis-ci.org/ekonstantinidis/django-rest-framework-docs +[travis-image]: https://travis-ci.org/manosim/django-rest-framework-docs.svg?branch=master +[travis-url]: https://travis-ci.org/manosim/django-rest-framework-docs [pypi-image]: https://badge.fury.io/py/drfdocs.svg [pypi-url]: https://pypi.python.org/pypi/drfdocs/ -[codecov-image]: https://codecov.io/github/ekonstantinidis/django-rest-framework-docs/coverage.svg?branch=master -[codecov-url]:https://codecov.io/github/ekonstantinidis/django-rest-framework-docs?branch=master +[codecov-image]: https://codecov.io/github/manosim/django-rest-framework-docs/coverage.svg?branch=master +[codecov-url]:https://codecov.io/github/manosim/django-rest-framework-docs?branch=master [slack-image]: https://img.shields.io/badge/slack-pythondev/drfdocs-e01563.svg [slack-url]: https://pythondev.slack.com diff --git a/demo/project/organisations/serializers.py b/demo/project/organisations/serializers.py index c1fc2b1..07cbfb8 100644 --- a/demo/project/organisations/serializers.py +++ b/demo/project/organisations/serializers.py @@ -3,11 +3,18 @@ from project.accounts.serializers import UserProfileSerializer +class MembershipSerializer(serializers.ModelSerializer): + class Meta: + model = Membership + fields = ('joined', 'is_owner', 'role') + + class CreateOrganisationSerializer(serializers.ModelSerializer): + membership_set = MembershipSerializer(many=True) class Meta: model = Organisation - fields = ('name', 'slug',) + fields = ('name', 'slug', 'membership_set') class OrganisationMembersSerializer(serializers.ModelSerializer): @@ -27,3 +34,11 @@ class OrganisationDetailSerializer(serializers.ModelSerializer): class Meta: model = Organisation fields = ('name', 'slug', 'is_active') + + +class RetrieveOrganisationSerializer(serializers.ModelSerializer): + membership_set = MembershipSerializer() + + class Meta: + model = Organisation + fields = ('name', 'slug', 'is_active', 'membership_set') diff --git a/demo/project/organisations/urls.py b/demo/project/organisations/urls.py index 423e04d..4d0311e 100644 --- a/demo/project/organisations/urls.py +++ b/demo/project/organisations/urls.py @@ -5,6 +5,7 @@ urlpatterns = [ url(r'^create/$', view=views.CreateOrganisationView.as_view(), name="create"), + url(r'^(?P[\w-]+)/$', view=views.RetrieveOrganisationView.as_view(), name="organisation"), url(r'^(?P[\w-]+)/members/$', view=views.OrganisationMembersView.as_view(), name="members"), url(r'^(?P[\w-]+)/leave/$', view=views.LeaveOrganisationView.as_view(), name="leave") diff --git a/demo/project/organisations/views.py b/demo/project/organisations/views.py index 7242f19..1e2d5fb 100644 --- a/demo/project/organisations/views.py +++ b/demo/project/organisations/views.py @@ -2,10 +2,15 @@ from rest_framework.response import Response from project.organisations.models import Organisation, Membership from project.organisations.serializers import ( - CreateOrganisationSerializer, OrganisationMembersSerializer + CreateOrganisationSerializer, OrganisationMembersSerializer, RetrieveOrganisationSerializer ) +class RetrieveOrganisationView(generics.RetrieveAPIView): + + serializer_class = RetrieveOrganisationSerializer + + class CreateOrganisationView(generics.CreateAPIView): serializer_class = CreateOrganisationSerializer diff --git a/docs/contributing.md b/docs/contributing.md index 13938f8..305e06c 100755 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -5,7 +5,7 @@ source_filename: contributing ### Development If you want to **use the demo** app to work on this package: -In the project [repository](https://github.com/ekonstantinidis/django-rest-framework-docs) you can find the demo app(at /demo). It is a project with Django & Django Rest Framework that will allow you to work with this project. +In the project [repository](https://github.com/manosim/django-rest-framework-docs) you can find the demo app(at /demo). It is a project with Django & Django Rest Framework that will allow you to work with this project. From the root of the repository: diff --git a/docs/installation.md b/docs/installation.md index 1e7805c..f0a4f68 100755 --- a/docs/installation.md +++ b/docs/installation.md @@ -22,4 +22,4 @@ Finally include the `rest_framework_docs` urls in your `urls.py`: url(r'^docs/', include('rest_framework_docs.urls')), ] -You can now visit [http://0.0.0.0:/8000/docs/](http://0.0.0.0:8000/docs/) to view your Web API's docs. +You can now visit [http://0.0.0.0:8000/docs/](http://0.0.0.0:8000/docs/) to view your Web API's docs. diff --git a/docs/template/base.html b/docs/template/base.html index 6ea52fa..0db72a9 100755 --- a/docs/template/base.html +++ b/docs/template/base.html @@ -56,8 +56,8 @@