Re: extending objects.get()
On 2009-09-03, at 4:40 PM, dwh wrote: j = Junk.objects.get(cheese='12345') > > The field cheese isn't part of Junk obviously. You can do anything you want in a custom manager. What cheese is and how possible that is, is up to you. -- Andy McKay Clearwind Consulting: www.clearwind.ca Twitter: @clearwind --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
extending objects.get()
Is it possible to add a custom search key within get() that are: 1) Not part of the containing model 2) Use custom SQL Example: class Junk(models.Model): name = models.CharField(maxlength=10) size = models.IntegerField() >>> j = Junk.objects.get(cheese='12345') The field cheese isn't part of Junk obviously. It maybe easier to use a custom Manager. I've done that but I'd like to know if the above is possible as the code is more symmetrical. TIA --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---