Search Results

Search found 1 results on 1 pages for 'user805981'.

Page 1/1 | 1 

  • Django loading mysql data into template correctly

    - by user805981
    I'm new to django and I'm trying to get display a list of buildings and sort them alphabetically, then load it into an html document. Is there something that I am not doing correctly? below is models.py class Class(models.Model): building = models.CharField(max_length=20) class Meta: db_table = u'class' def __unicode__(self): return self.building below is views.py views.py def index(request): buildinglist = Class.objects.all().order_by('building') c = {'buildinglist': buildinglist} t = loader.get_template('index.html') return HttpResponse(t.render(c)) below is index.html index.html {% block content%} <h3>Buildings:</h3> <ul> {% for building in buildinglist %} <li> <a href='www.{% building %}.com'> # ex. www.searstower.com </li> {% endfor %} </ul> {% endblock %} Can you guys point me in the right direction? Thank you in advance guys! I appreciate your help very much.

    Read the article

1