Hi all I have a problem I have been struggeling with for a while.
I have two models: InfoProxy and Permission A InfoProxy can have several Permissions class Permission(models.Model): info_proxy = models.ForeignKey(InfoProxy, related_name='permissions') permission_type = models.CharField(maxlength=1, choices=PERMISSION_CHOICES) usergroup = models.ForeignKey(UserGroup) class InfoProxy(models.Model, UrlItem): """ A proxy pointing to a (Info)Item """ info_type = models.ForeignKey(ContentType, related_name='infoproxies') info_id = models.PositiveIntegerField() info_item = generic.GenericForeignKey(ct_field="info_type", fk_field="info_id") render_type = models.ForeignKey(ContentType, related_name='render_infoproxies', blank=True, null=True) render_id = models.PositiveIntegerField(blank=True, null=True) render_item = generic.GenericForeignKey(ct_field="render_type", fk_field="render_id") created = models.DateTimeField('date created') modified = models.DateTimeField('date modified') owner = models.ForeignKey(User) language_code = models.CharField(maxlength=20) rank = models.IntegerField( blank=True, null=True) grade = models.IntegerField( blank=True, null=True) objects = InfoProxyManager() I want to query for all object a user has permission to read depending on groups (code below) This code works without any problems on developer server. On mod_python however I (sometimes) get the below error. If I hit refresh in the browser, it usually works. I have tried several things like: All imports are with full paths Classes put in site-packages (Maybe something is wrong when loading classes) I have checked so at least one permission exist on every InfoProxy Anyone have had a similar problem? Any hint that can help me try other options? Any help is very much appreciated. Sten ------------------------------------------ Error trace ------------------------------------------ File "/usr/local/lib/python2.4/site-packages/django/core/handlers/ base.py", line 77, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python2.4/site-packages/jellyspot/server/apps/ locations/proxy/views.py", line 264, in flashes result_list = ResultList(request, query) File "/usr/local/lib/python2.4/site-packages/jellyspot/server/apps/ common/results.py", line 36, in __init__ self.get_results(request) File "/usr/local/lib/python2.4/site-packages/jellyspot/server/apps/ common/results.py", line 84, in get_results raise IncorrectLookupParameters(str(e)) IncorrectLookupParameters: Cannot resolve keyword 'permissions' into field. Choices are: id, info_type, info_id, render_type, render_id, created, modified, owner, indexer, language_code, rank, grade -------------------------------------------------------------------------------- query code -------------------------------------------------------------------------------- try: if user and user.is_authenticated(): query = """select uub.usergroup_id from users_buddy as ub left join users_usergroup_buddies as uub on uub.buddy_id = ub.id where ub.buddy_id = %s """ % (user.id) cursor = connection.cursor() cursor.execute(query) group_idents = [item[0] for item in cursor.fetchall()] group_idents.append(USERGROUP_MEMBERS.id) else: group_idents = [] group_idents.append(USERGROUP_EVERYONE.id) if user and user.is_authenticated(): qs = self.all().filter( Q(owner__exact=user.id) | Q(permissions__usergroup__in=group_idents)).distinct() else: qs = self.all().filter(permissions__usergroup__in=group_idents).distinct() return qs except Exception, e: print e return self.get_empty_query_set() --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---