1👍
✅
You are only fetching the name
property in your view:
def home_page(request):
classList = SomeClass.objects.values('name')
------------------------------^^^^^^^^^^^^^^
This is why the other properties of your object are not available in your template.
Also, your template – not sure if its a copy paste problem:
{% for someClass in classList %}
<li><a href="/CLP/{{class.name}}">{{class.name}}</a></li>
{% endfor %}
Here I believe you need {{ someClass.name }}
Also, you have an indentation issue in your models:
def __unicode__(self):
return self.name
class Meta:
ordering = ('name',)
The class Meta:
should be at the same level as the def
, and __unicode__
should return a unicode object:
def __unicode__(self):
return unicode(self.name)
Source:stackexchange.com