class ValidParameter(models.Model):
# .. fields
class ValidRequest(models.Model):
# ... fields
optional = models.ManyToManyField(ValidParameter, null=True,
blank=True)
-----------------------------------------
Given the above models, I'd like to be able to do something like this:
from django.core.cache import cache
import pickle
request = models.ValidRequest.objects.select_related().get(pk=1)
cache.set("woot", pickle.dumps(request))
request = cache.get("woot")
# and have this not hit the database:
[x for x in request.optional.all()]
Is there a way to do this easily, or should I just cache the parameters
manually?
--
Adam Olsen
SendOutCards.com
http://www.vimtips.org
http://last.fm/user/synic
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---