Hello!
This is probably a really dumb question. However i just started python and django. So please spare me
I have created two views, and i would them to be displayed at the same page.
Can somebody please point me in the right direction?
Views:
def index(request):
shopping_list = Shopping.objects.order_by('shop_date')
template = loader.get_template('Home_Control/base.html')
context = {
'shopping_list': shopping_list,
}
return HttpResponse(template.render(context, request))
def home(request):
response = requests.get('http://ip.jsontest.com/')
geodata = response.json()
return render(request, 'Home_Control/base.html', {
'ip': geodata['ip']
})
urls:
urlpatterns = [
path('', views.index, name='index'),
path('', views.index, name='home'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)