# Functions/Views

**URL:** <https://forum.djangoproject.com/t/functions-views/1332>\
**Category:** Using Django\
**Created:** [March 1, 2020, 3:45pm UTC](https://forum.djangoproject.com/t/functions-views/1332 "2020-03-01T15:45:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhouwie](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mhouwie/32/805_2.png) [@mhouwie](https://forum.djangoproject.com/u/mhouwie)\
**Post date:** [March 1, 2020, 3:45pm UTC](https://forum.djangoproject.com/t/functions-views/1332/1 "2020-03-01T15:45:07Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [March 1, 2020, 4:15pm UTC](https://forum.djangoproject.com/t/functions-views/1332/2 "2020-03-01T16:15:33Z")

</div>

It’s not possible to have two views displayed at the same URL. Django will only match and run one. You’ll need to combine the code and templates if you want to show both sets of data and HTML.

---

<div class="post-metadata">

**Author:** ![mhouwie](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mhouwie/32/805_2.png) [@mhouwie](https://forum.djangoproject.com/u/mhouwie)\
**Post date:** [March 2, 2020, 4:57pm UTC](https://forum.djangoproject.com/t/functions-views/1332/3 "2020-03-02T16:57:18Z")

</div>

Thanks! So would that mean that i have to combine the functions? And the render that to one Template?

---

<div class="post-metadata">

**Author:** ![adamchainz](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/adamchainz/32/26_2.png) [@adamchainz](https://forum.djangoproject.com/u/adamchainz)\
**Post date:** [March 2, 2020, 5:27pm UTC](https://forum.djangoproject.com/t/functions-views/1332/4 "2020-03-02T17:27:41Z")

</div>

Indeed 🙂
