Code is functional, but doesn't display corresponding JSON text for each view?
This commit is contained in:
parent
be5c722eca
commit
c5e7fc879f
3 changed files with 105 additions and 15 deletions
|
@ -1,9 +1,20 @@
|
||||||
# from django.urls import path
|
# Rupika Dikkala
|
||||||
|
# January 19, 2019
|
||||||
|
# Add views for each path and
|
||||||
|
# link their appropriate functions
|
||||||
|
|
||||||
from django.conf.urls import url, include
|
from django.urls import path
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^$', views.profile),
|
path('', views.create_report),
|
||||||
# path('')
|
path('', views.delete_report),
|
||||||
|
path('', views.get_report),
|
||||||
|
path('', views.list_report),
|
||||||
|
path('', views.update_report),
|
||||||
|
path('', views.submit_report),
|
||||||
|
path('', views.update_section),
|
||||||
|
path('', views.create_account),
|
||||||
|
path('', views.login),
|
||||||
|
path('', views.logout),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,16 +1,80 @@
|
||||||
|
# Rupika Dikkala
|
||||||
|
# January 19, 2019
|
||||||
|
# Creating views for URL that
|
||||||
|
# returns JSON data
|
||||||
|
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create Report
|
||||||
|
def create_report(request):
|
||||||
# each stub.
|
|
||||||
def profile(request):
|
|
||||||
data = {
|
data = {
|
||||||
'name': 'Vitor',
|
'name': 'create report',
|
||||||
'location': 'Finland',
|
|
||||||
'is_active': True,
|
|
||||||
'count': 28
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# Delete report
|
||||||
|
def delete_report(request):
|
||||||
|
data = {
|
||||||
|
'name': 'Delete report',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# Get report
|
||||||
|
def get_report(request):
|
||||||
|
data = {
|
||||||
|
'name': 'get report',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# List Reports
|
||||||
|
def list_report(request):
|
||||||
|
data = {
|
||||||
|
'name': 'list report',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# Update Reports
|
||||||
|
def update_report(request):
|
||||||
|
data = {
|
||||||
|
'name': 'update report',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# Submit Reports
|
||||||
|
def submit_report(request):
|
||||||
|
data = {
|
||||||
|
'name': 'submit report',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# Update section
|
||||||
|
def update_section(request):
|
||||||
|
data = {
|
||||||
|
'name': 'update section',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
|
||||||
|
# Create account
|
||||||
|
def create_account(request):
|
||||||
|
data = {
|
||||||
|
'name': 'create account',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# Login
|
||||||
|
def login(request):
|
||||||
|
data = {
|
||||||
|
'name': 'login',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
# Logout
|
||||||
|
def logout(request):
|
||||||
|
data = {
|
||||||
|
'name': 'logout',
|
||||||
|
}
|
||||||
|
return JsonResponse(data)
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,24 @@ Including another URLconf
|
||||||
1. Import the include() function: from django.urls import include, path
|
1. Import the include() function: from django.urls import include, path
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
|
||||||
from django.urls import path
|
|
||||||
|
|
||||||
|
# Rupika Dikkala
|
||||||
|
# January 19, 2019
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.urls import path, include
|
||||||
|
|
||||||
|
# add urls to this array
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
|
path('create_report/', include("backend.urls")),
|
||||||
|
path('delete_report/', include("backend.urls")),
|
||||||
|
path('get_report/', include("backend.urls")),
|
||||||
|
path('list_reports/', include("backend.urls")),
|
||||||
|
path('update_report/', include("backend.urls")),
|
||||||
|
path('submit_report/', include("backend.urls")),
|
||||||
|
path('update_section/', include("backend.urls")),
|
||||||
|
path('create_account/', include("backend.urls")),
|
||||||
|
path('login/', include("backend.urls")),
|
||||||
|
path('logout/', include("backend.urls")),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue