Added API link to menu, organized API folder, changed dockerfile, readme

pull/26/head
Piero Toffanin 2016-10-04 13:07:17 -04:00
rodzic fea4f970c6
commit d686e63c40
7 zmienionych plików z 36 dodań i 23 usunięć

Wyświetl plik

@ -13,9 +13,9 @@ ADD requirements.txt /webodm/
RUN pip install -r requirements.txt
# swagger_spec_validator is not up to date, fetch directly from github
RUN pip install --upgrade git+https://github.com/Yelp/swagger_spec_validator
# also install django-knockout
RUN pip install --upgrade git+https://github.com/Yelp/swagger_spec_validator git+https://github.com/pierotofy/django-knockout
# Add repository files
ADD . /webodm/
RUN git submodule init

Wyświetl plik

@ -62,7 +62,7 @@ Then:
```
pip install -r requirements.txt
pip install --upgrade git+git://github.com/Yelp/swagger_spec_validator
pip install --upgrade git+git://github.com/Yelp/swagger_spec_validator git+https://github.com/pierotofy/django-knockout
chmod +x start.sh && ./start.sh
```

Wyświetl plik

Wyświetl plik

@ -0,0 +1,17 @@
from django.contrib.auth.models import User
from rest_framework import serializers, viewsets
from app import models
class ProjectSerializer(serializers.HyperlinkedModelSerializer):
owner = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())
class Meta:
model = models.Project
class ProjectViewSet(viewsets.ModelViewSet):
"""
Projects the current user has access to, including the ability to create new ones.
"""
queryset = models.Project.objects.all()
serializer_class = ProjectSerializer

11
app/api/urls.py 100644
Wyświetl plik

@ -0,0 +1,11 @@
from django.conf.urls import url, include
from .projects import ProjectViewSet
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r'projects', ProjectViewSet)
urlpatterns = [
url(r'^', include(router.urls)),
url(r'^auth/', include('rest_framework.urls')),
]

Wyświetl plik

@ -262,6 +262,9 @@
<a href="/admin/"><i class="fa fa-gears fa-fw"></i> {% trans 'Administration' %}</a>
</li>
{% endif %}
<li>
<a href="/api/"><i class="fa fa-book fa-fw"></i> {% trans 'API' %}</a>
</li>
<li>
<a href="#"><i class="fa fa-life-saver fa-fw"></i> {% trans 'Documentation' %}</a>
</li>

Wyświetl plik

@ -1,28 +1,10 @@
from django.conf.urls import url, include
from . import views, models
from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
class ProjectSerializer(serializers.HyperlinkedModelSerializer):
owner = serializers.PrimaryKeyRelatedField(queryset=User.objects.all())
class Meta:
model = models.Project
class ProjectViewSet(viewsets.ModelViewSet):
queryset = models.Project.objects.all()
serializer_class = ProjectSerializer
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'projects', ProjectViewSet)
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^dashboard/$', views.dashboard, name='dashboard'),
url(r'^processingnode/([\d]+)/$', views.processing_node, name='processing_node'),
url(r'^api/', include(router.urls)),
url(r'^api/auth/', include('rest_framework.urls')),
url(r'^api/', include("app.api.urls")),
]