I am programming in Django 1.4.3 with Python 2.7 on Windows Vista. I am trying to input features for the user such as telephone in localhost:8000/admin and then display then on the front web page. I have index.html for the front page:
<!-- Shows the label on tab. -->
{% block title %} Inicio - Bienvenidos {% endblock %}
{% block content %}
<p> Esta es mi primera pagina en Django </p>
{% if user.is_authenticated %}
<p> Bienvenido {{user.username}} </p>
{% if user.get_profile.photo %}
<img src="/media/{{user.get_profile.photo}}" width="100px" height="100px"/>
{% endif %}
{% if user.get_profile.telefono %}
<p> Numero Tel:</p> {{user.get_profile.telefono}}</p>
{% endif %}
{% endif %}
{% endblock %}
And it is pulling input values defined in models.py:
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class userProfile(models.Model):
def url(self, filename):
ruta = "MultimediaData/Users/%s/%s"%(self.user.username, filename)
return ruta
user = models.OneToOneField(User)
photo = models.ImageField(upload_to = url)
telefono = models.CharField(max_length = 30)
def __unicode__(self):
return self.user.username
However, after I input the telefono (telephone) value, the front page does not display it. I have attached the front page I am getting. The number should appear under the fish fillets image. What seems to be the problem?
get_profilemethod has been deprecated.