sorry kenneth ...but I have stored information(resume) of professors in the database. in models.py , i have taken fields like name, dob, qualification,designation etc. then these are saved in the database of every professor. but the point is designation of professors vary(like there are professors, assistant professors and associate professors).I want that it should count the no of professors, assistant professors and associate professors automatically and increments their value after I fill and save the next resume in the database. Is there any logic like this...plz help me. I shall be very thankfull.
On Tue, Jul 3, 2012 at 4:22 AM, kenneth gonsalves <law...@thenilgiris.com>wrote: > On Tue, 2012-07-03 at 04:16 -0700, Bharati Sharma wrote: > > thanks kenneth ...but will it count those entries also which I will > > enter > > in the database after using filter() and count()? > > if you want to know the number of assistant profs do a query like this: > > no_of_asstprofs = > Faculty.objects.filter(job_title='AssistantProf').count() > > do not store this in the database - call it when you need it. If you > have a counter, you need to maintain it - increment when adding, reduce > when deleting - which also means setting up signals to adjust the > counter when a model is changed. A huge waste of time and energy. > > > -- > regards > Kenneth Gonsalves > > -- > 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. > > -- 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.