mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #409 from SchrodingersGat/info-endpoint
Add a simple endpoint with server information
This commit is contained in:
commit
ea44f28bc7
@ -31,6 +31,7 @@ from django.views.generic.base import RedirectView
|
|||||||
from rest_framework.documentation import include_docs_urls
|
from rest_framework.documentation import include_docs_urls
|
||||||
|
|
||||||
from .views import IndexView, SearchView, SettingsView, EditUserView, SetPasswordView
|
from .views import IndexView, SearchView, SettingsView, EditUserView, SetPasswordView
|
||||||
|
from .views import InfoView
|
||||||
|
|
||||||
from users.urls import user_urls
|
from users.urls import user_urls
|
||||||
|
|
||||||
@ -45,6 +46,9 @@ apipatterns = [
|
|||||||
|
|
||||||
# User URLs
|
# User URLs
|
||||||
url(r'^user/', include(user_urls)),
|
url(r'^user/', include(user_urls)),
|
||||||
|
|
||||||
|
# InvenTree information endpoint
|
||||||
|
url(r'^$', InfoView.as_view(), name='inventree-info'),
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
@ -19,6 +19,7 @@ from part.models import Part
|
|||||||
|
|
||||||
from .forms import DeleteForm, EditUserForm, SetPasswordForm
|
from .forms import DeleteForm, EditUserForm, SetPasswordForm
|
||||||
from .helpers import str2bool
|
from .helpers import str2bool
|
||||||
|
from .version import inventreeVersion
|
||||||
|
|
||||||
from rest_framework import views
|
from rest_framework import views
|
||||||
|
|
||||||
@ -392,6 +393,21 @@ class AjaxDeleteView(AjaxMixin, UpdateView):
|
|||||||
return self.renderJsonResponse(request, form, data=data, context=context)
|
return self.renderJsonResponse(request, form, data=data, context=context)
|
||||||
|
|
||||||
|
|
||||||
|
class InfoView(AjaxView):
|
||||||
|
""" Simple JSON endpoint for InvenTree information.
|
||||||
|
Use to confirm that the server is running, etc.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'server': 'InvenTree',
|
||||||
|
'version': inventreeVersion()
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
|
||||||
class EditUserView(AjaxUpdateView):
|
class EditUserView(AjaxUpdateView):
|
||||||
""" View for editing user information """
|
""" View for editing user information """
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user