On Monday 01 May 2006 12:08, Dagur wrote:

> On further inspection I found out
> that the "authorised" field is set to all users before saving but is
> empty after saving.
>
> >>> t = Topic()
> >>> t.authorised.count()
>
> 2773L
>
> >>> t.save()
> >>> t.authorised.count()
>
> 0L
>
> Is this the desired behavior?

This is kind of a bug, caused by the fact that the ID of 't' is not set 
until it is saved, and 'authorised' is a dynamic attribute that does a 
database query on the many-to-many database table when you access it.  
It's impossible to evaluate .authorised properly until you have saved 
the object at least once.

It would be possible to get Django to throw an exception in this case.  
What do people think about that?

Luke

-- 
"In my opinion, we don't devote nearly enough scientific research to 
finding a cure for jerks." (Calvin and Hobbes)

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to