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

2017-11-28 Thread Matemática A3K
>
> I have this error:
>
> Unhandled exception in thread started by  check_errors..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:
>
> *: (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+unsubscr...@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+unsubscr...@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.


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

2017-11-28 Thread Allan Nava


Il giorno venerdì 27 febbraio 2009 15:14:13 UTC+1, Daniel Roseman ha 
scritto:
>
> On Feb 27, 1:21 pm, Anders  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. () 
> > 
> > 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 .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:

*: (admin.E001) The value 
of 'raw_id_fields' must be a list or tuple.*

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+unsubscr...@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.


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

2009-02-27 Thread Daniel Roseman

On Feb 27, 1:21 pm, Anders  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. ()
>
> 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.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



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

2009-02-27 Thread Anders

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. ()

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

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---