On Tue, Jul 3, 2012 at 11:55 AM, Bharati Sharma <bharati21...@gmail.com> wrote:
> I want to add counter in my project so that the value in the table increases
> as the data is put in the database. Can anyone help me plz.
>
If you want a counter in database, you can make it auto-increment.
Like I want job_no as a counter field in a table, then in models.py, add this :

job_no = models.AutoField(primary_key=True)

But if you want the counter in tables in the template file then add
<td>{{forloop.counter}}</td> as your table field.

Correct me if I am wrong anywhere.

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

-- 
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.

Reply via email to