Il giorno venerdì 27 febbraio 2009 15:14:13 UTC+1, Daniel Roseman ha scritto:
On Feb 27, 1:21 pm, Anders <anders.grimsrud.erik...@gmail.com > wrote:
> Hi.
>
> In the users admin of Django admin there is a nice way of selecting
> permissions for each user by adding and removing permissions from a
> list of available permissions. (<div class="selector">)
>
> I have models set up similar to the ones used for users and
> permissions, but I am not able to get the nice "select from list on
> left side and add to right side"-widget. I only get a normal multi-
> select box.
>
> My models could look like this:
>
> class Interest(models.Model):
> name= models.CharField(max_length=255)
>
> class Person(models.Model):
> name= models.CharField(max_length=255)
> .....
> interests = models.ManyToManyField(Interest)
>
> How can I get the fancy manytomany-widget in the Person admin?
>
> thanks
>
> Anders
Specify a 'filter-horizontal' tuple in the admin model declaration:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/# filter-horizontal
--
DR.
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
this is my admin.py
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.
No comments:
Post a Comment