On Apr 5, 11:53 am, Willem <mati...@gmail.com> wrote:
> Thanks DR -- see below
>
> class ProfileManager(models.Manager):
>
>     def recently_added_people(self):
>         cache_key = 'recently_added_people'
>         profile_list = cache.get(cache_key)
>         if profile_list is None:
>             list = Profile.objects.order_by('-id').filter(
>                     Q(user__is_active='1')
>                     )[0:5]
>             profile_list = []
>             for profile in list:
>                 profile_list.append({
>                     'last_name' : profile.user.last_name,
>                     })
>             cache.set(cache_key, profile_list)
>         return profile_list
>
> class Profile(models.Model):
>     user = models.ForeignKey(User, unique=True)   # unique = True is
> so that 1:1 Profile:User
> #
> #  .. deleted some lines here
> #
>     temp1       = models.CharField(max_length=40, blank=True)
>
>     def __unicode__(self):
>         return u"%s - %s" % (self.user, self.country)
>     objects = ProfileManager()    # custom

I must say this is a confusing one. What happens if you replace
'country' with 'country_code' as the final argument in the {% cache %}
templatetag?

Also I'm not sure of the relevance of the Manager you post above - is
that called from this code anywhere?
--
DR.

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

Reply via email to