Re: Inspect a Model in Django

2010-07-21 Thread Santiago Perez
from looking at the fields_for_model(...) method in django.forms.model, it doas opts = model._meta for f in opts.fields + opts.many_to_many: # for each field it ends up calling f.formfield() which in CharField is implemented as: def formfield(self, **kwargs): de

Re: using the update() method

2010-07-21 Thread Santiago Perez
I think that what you want can be accomplished by: from django.db.models import F readers = Readers.objects.filter(status=active) readers.update(sorter=(F('library') + F('book')) On Wed, Jul 21, 2010 at 19:40, Nick wrote: > > I am trying to loop through a queryset and assign values to a field

Re: filter users by full name

2010-07-22 Thread Santiago Perez
If you're using MySQL then this should work: models.User.objects.extra(where=["concat(first_name, ' ', last_name)=%s"], params=["John Test"]) Not sure how portable the concat function is or what alternatives are there in other backends but shouldn't be very hard to find out. On Fri, Jul 23, 2010