I have the following in models:
class Companies(models.Model):
ComName = models.CharField(max_length=255)
ComURL = models.CharField(max_length=1024,null=True)
class Products(models.Model):
PrName = models.CharField(max_length=255)
PrCompany = models.ForeignKey(Companies)
and the following in the template:
{% if products %}
var markers = [
{% for product in products %}{"url":"{{ product.PrCompany.ComURL }}","name":"{{ product.PrName }}"},{% endfor %}
]
{% endif %}
{% endblock %}
but the output i get is:
var markers = [
{"url":"None","name":"Samsung GT-S7350"},{"url":"None","name":"SonyEricsson W395"},{"url":"None","name":"Nokia E75"},
]
I look in the database, and each entry has a value in there, which is not empty. Why does it say "None" ? Something is not right in the relation?