-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

i've got a problem while moving a django project from one host (debian
linux) to another (suse linux) and it seems, that there is a problem
with djangos database/models modules.

on the current host i can do something like that:
|> from board.models import Thread
|> x = Thread.view_manager.get(pk=2)
|> x.date
datetime.datetime(2008, 8, 19, 22, 20, 41)

x.date returns aa datetime object.
(date in board_post is a DATETIME field in the database).

on the new host, the same commands return this:
|> from board.models import Thread
|> x = Thread.view_manager.get(pk=2)
|> x.date
u'2008-08-19 22:20:41'

x.date returns a unicode string even its the same code, the same
database and same versions (database, python-mysqldb, python itself).

but if i execute the same query on the new host directly using MySQLdb:

|>> c.execute('SELECT date FROM board_post WHERE board_post.thread_id=2
ORDER BY date DESC LIMIT 1')
1L
|>> c.fetchone()[0]
datetime.datetime(2008, 8, 19, 22, 20, 41)

This is the code used for Thread.view_manager:

class ThreadManager(models.Manager):
~    def get_query_set(self):
~        extra_last_updated = """
~            SELECT date FROM board_post
~                WHERE board_post.thread_id = board_thread.id
~                ORDER BY date DESC LIMIT 1
~            """

~        return super(ThreadManager, self).get_query_set().extra(
~            select = {
~                'date': extra_last_updated,
~            },).exclude(deleted=True).order_by('-date')


I have no idea why this problem appears.. any ideas?

thanks in advance  :-)

best regards,

- --
Stephan Jäkel

e-Mail  : [EMAIL PROTECTED]
Website : http://rdev.info
Mobile  : +49 163 458 9 173

What do you mean that could take down the whole network?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFItvVr4B/i3Mb6qe4RAjUBAJ9YFNLeznIIbAHTQRlndZ4IqJGAAQCgru2T
EDKCFfENKSlw9aKSAE6p4dM=
=SGVp
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to