In Django, my data isn't rendering

I'm learning Django, and trying to see if I can come up with a simple app, that just keep track of text only pins.

I can access the admin and view and create objects there without problem. What I am having trouble with is understanding why the data isn't coming up in the template.

My code is below.

models.py
from django.db import models
from django.utils import timezone


class Pin(models.Model):
    created_at = models.DateTimeField(default=timezone.now)
    title = models.CharField(max_length=255, default="Untitled")
    description = models.TextField(default="")

    def __str__(self):
        return self.title

Open in new window


admin.py
from django.contrib import admin
from .models import Pin

admin.site.register(Pin)

Open in new window


urls.py
from django.conf.urls import url
from django.contrib import admin
from . import views

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', views.pin_list),
]

Open in new window


view.py
from django.shortcuts import render
from . models import Pin


def pin_list(request):

    pins = Pin.objects.all()
    return render(request, "pin_list.html", {'pins': pins})

Open in new window


pin_list.html
{% load staticfiles %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Pins</title>
</head>
<body>


<img height = "50px" src = "{%  static "images/logo.jpg" %}" >

<ul>
{% for p in pins %}

    <li>{{ p.tile }}</li>

{% endfor %}
</ul>

</body>
</html>

Open in new window


When I runserver and look at the "view source" of the resulting html I get this
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Pins</title>
</head>
<body>


<img height = "50px" src = "/static/images/logo.jpg" >

<ul>

</ul>

</body>
</html>

Open in new window


Why isn't my data coming up? What am I missing?
Shana HAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cyclops3590Commented:
looks like you have a typo.  should be p.title, not p.tile.  That can cause this.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cyclops3590Commented:
this was tested in my own lab so unless it was a typo in pasting to EE that was the issue
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.