Hi,
I've subclassed the manager in a model to add a custom method.
class ClientManager(models.Manager):
"""This is a custom manager for the Client model, implementing
some custom
methods for bulk editing of clients in the database in a more
efficient
manner."""
def disconnectAll(self):
"""This method is run at tug startup and shutdown to ensure
that all
clients have the proper initial state of disconnected. It also
removes
all SIP clients, since they cannot be persistent."""
cursor = connection.cursor()
cursor.execute("""
UPDATE clients_client
SET connected = 'f'
""")
cursor.execute("""
DELETE FROM clients_client
WHERE clientid like '%SIP'
""")
This seems to work in production with postgreSQL, but on my laptop
with sqlite I'm seeing an issue.
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/msoulier/work/mitel-msl-tug/root/etc/e-smith/web/django/
teleworker/../teleworker/clients/models.py", line 22, in disconnectAll
""")
File "/home/msoulier/python/lib/python2.5/site-packages/django/db/
backends/util.py", line 21, in execute
'sql': sql % params,
TypeError: not enough arguments for format string
It looks like the util backend doesn't allow the standard % character
for a LIKE comparison.
Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---