On Sep 18, 4:34 pm, Oleg Oltar <oltarase...@gmail.com> wrote: > Hi! > > I have following model: > > class UserProfile(models.Model): > """ > User profile model, cintains a Foreign Key, which links it to the > user profile. > """ > about = models.TextField(blank=True) > user = models.ForeignKey(User, unique=True) > ranking = models.IntegerField(default = 1) > avatar = models.ImageField(upload_to="usermedia", default = > 'images/js.jpg') > updated = models.DateTimeField(auto_now=True, default=datetime.now()) > is_bot = models.BooleanField(default = False) > is_active = models.BooleanField(default = True) > is_free = models.BooleanField(default = True) > objects = ProfileManager() > > def __unicode__(self): > return u"%s profile" %self.user > > And a manager > > class ProfileManager(models.Manager): > """ > Stores some additional helpers, which to get some profile data > """ > def get_active_members(self): > ''' > Get all people who are active > ''' > return self.filter(is_active = True) > > When, I try to call something like UserProfile.obgets.get_active_members() > > I am getting the > > raise AttributeError, "Manager isn't accessible via %s instances" % > type.__name__ > AttributeError: Manager isn't accessible via UserProfile instances > > Could you please help
Are you really calling UserProfile.objects.get_active_members()? If so, this should work. But the error says you are calling it from a UserProfile *instance*. Please show the exact code that you're using to call the manager. -- 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-users@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 -~----------~----~----~----~------~----~------~--~---