You can access just the values by the values property, {% for value in object.values %} <td>{{ value }}</td> {% endfor %}
On Sep 17, 4:33 am, Phang Mulianto <braveh...@gmail.com> wrote: > hi .. > > i have a pagination objects : > > in my view i got query and paginate it using this : > > objects = paginator.page(page) > > then the objects goes into the view template. > i can populate the field value using this template : > > {% for object in objects.object_list %} > <tr class="{% cycle 'altRow' 'evenRow' %}"> > <td>{{ object.title }}</td> > <td>{{ object.content }}</td> > <td>{{ object.slug }} </td> > <td>{{ object.is_publish }} </td> > <td>{{ object.created_at }} </td> > <td>{{ object.updated_at }} </td> > {% endfor %} > > This solution give the field values of know field name, like title, content, > slug, etc... > > what i want to aim is to access the field value which is unknow, like say it > is different model . > i want to use this template in any model i give the to the object_list > variable. > > how to achieve this. > i try this one : > {% for x in object.items %} > <td>{{ x }}</td> > {% endfor %} > > The html result are in table like this : > ('is_publish', True)('title', u'first day with django')('created_at', > datetime.datetime(2011, 7, 10, 18, 6, 18))('updated_at', > datetime.datetime(2011, 8, 23, 0, 26, 42))('content', u'Great > start...progressing now...')('pk', 1L)('slug', u'first-day-django') > > but it show the field name and the field value. how i access the value of > the field. > > i want to create a record list, but not a view template for each model, but > 1 template for every model. > > i hear the django table, but i want to do it my own way.. > > anyone have suggestion. > > Thanks. > Mulianto -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.