Environment: Python 3.6 Django 2.0 Django REST 3
I am connecting a django project with an android application and everything has worked correctly but I have a problem that anyone who accesses the url of the requests in android can see that data. I want to block that render or template and only return the json data that I need for my android application.
myapp/View.py
class restContact(APIView):
def get(self, request):
allcontact = Contact.objects.all()
serializer = ContactSerializer(allcontact, many=True)
return Response({"state":"1","control":serializer.data},status=status.HTTP_400_BAD_REQUEST)
myapp/Url.py
from django.contrib import admin
from django.conf.urls import url,include
from apps.my-app.views import restContact
urlpatterns = [
url(r'^contacts/$', restContact.as_view()),
]
proyect/url.py
from django.conf.urls import url
from django.urls import include
from django.contrib import admin
urlpatterns = [
url(r'',include('apps.index.urls')),
url(r'^admin/', admin.site.urls),
url(r'^index/',include('apps.index.urls')),
url(r'^movil/', include('apps.myapp.urls')),
]
I just need to return jsonObject and in the browser to write the url www.mypage.com/movil/contacts can not see all the data in the get.