Tuesday, November 28, 2017

Re: ManyToMany widget in admin - the "user - permission way.."



I have this error:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f2fa8d646a8>

Traceback (most recent call last):

  File "/usr/local/lib/python3.5/dist-packages/django/utils/autoreload.py", line 228, in wrapper

    fn(*args, **kwargs)

  File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/runserver.py", line 125, in inner_run

    self.check(display_num_errors=True)

  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 405, in check

    raise SystemCheckError(msg)

django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:


ERRORS:

<class 'bootcamp.groups_manager.admin.GroupAdmin'>: (admin.E001) The value of 'raw_id_fields' must be a list or tuple.


this is my admin.py

Because for making a tuple of one element you need a trailing comma, otherwise it is just a string, see below:
 

from django.contrib import admin

from bootcamp.groups_manager.models import Group, Member, GroupType, GroupEntity, GroupMember, GroupMemberRole
from guardian.admin import GuardedModelAdmin

# With object permissions support
class GroupAdmin(GuardedModelAdmin):
#fields = ('group_members', 'django_group')
raw_id_fields = ('group_members', )
#search_fields = ('group_members', 'django_group')
pass

#admin.site.register(models.Group)
admin.site.register(Group, GroupAdmin)
admin.site.register(Member)
admin.site.register(GroupType)
admin.site.register(GroupEntity)
admin.site.register(GroupMember)
admin.site.register(GroupMemberRole) 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/951cd1bc-5888-4d4f-b92b-fc855cb963a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BFDnhJAae_MaO6j2RaA1%2B3Ka%3DqdYP_DFcH4F3iUYiVARchimA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment