On Tuesday, 11 October 2011 15:17:18 UTC+1, eyscooby wrote: > > slowly getting there thanks to your help. > I am actually trying to accomplish this in the Admin interface, so I > am not sure how to use the template tag {{ ticket.days_old }} in that > situation. > > the other part I left off yesterday under my model I then had.. > (trying to get code formatting correct but keeps going to the left > margin on me when i post) > > def days_old(self): > return self.objects.datecalc() > days_old.short_discription = 'Days Old' > > more or less is that a correct way I would pull in a custom manager, > lets say if this one didn't have the iteration to it which seems be to > be my problem part now. > > thanks >
No, because that's not what managers are for. Managers are interacting with the database, and getting and returning one or more new model instances. If you already have an object, and you want to calculate the date on it, you want a model method that simply returns a value, not call the manager. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/Xz738Z_ozdYJ. 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.