Running into a similar issue on my own project, seems to be when you try an 
cache a model which has a related model which in turn has a many to many 
field. So for example, I have an instance of a Student, which has a 
ForeignKey to Book, which in turn has a ManyToMany to Author. If I try and 
cache my Student instance, I get that pickling error. In Django 1.4 it 
worked fine, but not in 1.5.

Figure out a resolution to this?

On Tuesday, March 19, 2013 10:17:46 PM UTC-7, Sir Anthony wrote:
>
> Hello,
> I'm using 
> django-audit-log<https://github.com/SirAnthony/django-audit-log>witch 
> actively creates dynamic models by calling type('%sAuditLogEntry' 
> % meta_name, (models.Model,), 
> attrs)<https://github.com/SirAnthony/django-audit-log/blob/master/audit_log/models/managers.py#L201>.
>  
> In django 1.5 I getting error when trying to cache it (pickling phase). 
> Example error string: Can't pickle <class 
> 'testproject.models.TestItemAuditLogEntry'>: attribute lookup 
> testproject.models.TestItemAuditLogEntry failed. I think it because pickle 
> tries to use class name with current environment.
> I looked in django sources and found that this 
> commit<https://github.com/django/django/commit/146aff3bac974e56ec8cb597c2720d1cd4f77b26>is
>  cause of such behaviour. 
> I'm not sure it is django bug (I'll write a ticket with test case and 
> probably patch, instead), maybe I just need to made some hacks on my side, 
> like implement intermediate model with custom __reduce__ like in 1.4 django 
> or something alike.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to