diff --git a/api/serializers.py b/api/serializers.py new file mode 100644 index 00000000..a526d463 --- /dev/null +++ b/api/serializers.py @@ -0,0 +1,24 @@ +# Re2o est un logiciel d'administration développé initiallement au rezometz. Il +# se veut agnostique au réseau considéré, de manière à être installable en +# quelques clics. +# +# Copyright © 2018 Mael Kervella +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +"""api.serializers + +Serializers for the API app +""" diff --git a/api/tests.py b/api/tests.py new file mode 100644 index 00000000..21fa6d24 --- /dev/null +++ b/api/tests.py @@ -0,0 +1,25 @@ +# Re2o est un logiciel d'administration développé initiallement au rezometz. Il +# se veut agnostique au réseau considéré, de manière à être installable en +# quelques clics. +# +# Copyright © 2017 Gabriel Détraz +# Copyright © 2017 Goulven Kermarec +# Copyright © 2017 Augustin Lemesle +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from django.test import TestCase + +# Create your tests here. diff --git a/api/urls.py b/api/urls.py new file mode 100644 index 00000000..9bac173e --- /dev/null +++ b/api/urls.py @@ -0,0 +1,30 @@ +# Re2o est un logiciel d'administration développé initiallement au rezometz. Il +# se veut agnostique au réseau considéré, de manière à être installable en +# quelques clics. +# +# Copyright © 2018 Mael Kervella +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +"""api.urls + +Urls de l'api, pointant vers les fonctions de views +""" + +from __future__ import unicode_literals + +from django.conf.urls import url + +urlpatterns = [ +] diff --git a/api/views.py b/api/views.py new file mode 100644 index 00000000..12864394 --- /dev/null +++ b/api/views.py @@ -0,0 +1,25 @@ +# Re2o est un logiciel d'administration développé initiallement au rezometz. Il +# se veut agnostique au réseau considéré, de manière à être installable en +# quelques clics. +# +# Copyright © 2018 Maël Kervella +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +"""api.views + +The views for the API app. They should all return JSON data and not fallback on +HTML pages such as the login and index pages for a better integration. +""" diff --git a/re2o/settings.py b/re2o/settings.py index f88bd266..d1c27192 100644 --- a/re2o/settings.py +++ b/re2o/settings.py @@ -76,7 +76,8 @@ INSTALLED_APPS = ( 'preferences', 'logs', 'rest_framework', - 'reversion' + 'reversion', + 'api' ) + OPTIONNAL_APPS MIDDLEWARE_CLASSES = ( diff --git a/re2o/urls.py b/re2o/urls.py index 48a7ea98..52eafaab 100644 --- a/re2o/urls.py +++ b/re2o/urls.py @@ -27,12 +27,18 @@ The `urlpatterns` list routes URLs to views. For more information please see: Examples: Function views 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') + 2. Add a URL to urlpatterns: url(r'^$', views.home) + 3. Optional: Add a custom name for this URL: + url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view()) + 3. Optional: Add a custom name for this URL: + url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) + 2. Optional: Add a custom namespace for all URL using this urlpatterns: + url(r'^blog/', include('blog.urls'), namespace='blog') """ from __future__ import unicode_literals @@ -61,5 +67,6 @@ urlpatterns = [ r'^preferences/', include('preferences.urls', namespace='preferences') ), + url(r'^api/', include('api.urls', namespace='api')), ]