Hi,

I'm trying to use Model Managers to write some per model
functionality. I have a Book model that needs to be able to convert
some of it's members into SoldBook items.

I want to be able to do:
Book.objects.filter(supplier='Jones').convert_sold()

I'm basing my code on 
http://stackoverflow.com/questions/2163151?tab=votes#tab-top
but my model looks like this:

from custom_queryset import CustomQuerySetManager #see link above
from django.db.models.query import QuerySet

class Book(models.Model):
    objects = CustomQuerySetManager()

    class QuerySet(QuerySet):
        def convert_sold(self):
            for book in self.all():
                sb = SoldBook()
                sb.title = book.title
                #etc
                sb.save()
                book.delete()

but when I call it with
Book.objects.filter(supplier='Jones').convert_sold()

File "/home/user/webapps/django/lib/python2.5/django/db/models/sql/
compiler.py", line 843, in as_sql
    placeholder = field.get_placeholder(val, self.connection)
TypeError: get_placeholder() takes exactly 2 arguments (3 given)

Unfortunately I'm using django trunk revision 11728 (5 months old?)
because webfaction haven't fixed their GIS database support for more
recent djangos :-(

Any idea how to fix this would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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