Thursday, September 18, 2014

Re: Customise admin view

That's great
Thank you very very much Helton




Le jeudi 18 septembre 2014 15:44:44 UTC+2, Helton Alves a écrit :
I think this will resolve your problem. :D

in admin, you use the get_queryset.
in this case return only items of user, you can change this for return the items that user have permission.

class MyModelAdmin(admin.ModelAdmin):      def queryset(self, request):          qs = super(MyModelAdmin, self).queryset(request)          if request.user.is_superuser:              return qs          return qs.filter(author=request.user)

2014-09-18 14:17 GMT+01:00 Salvatore DI DIO <salvato...@gmail.com>:
Hy Elton,

In fact each image belongs to an album.
Let us say I have three album ALB1 ALB2 ALB3

In the admin form, when I add an image I can attach it to either of each Albums
or all the three if I want

What I would like is show the album list for a particuliar user.

For example Tom could only add images in ALB1
                   Henry could add images in ALB2 and ALB3
                  ....

I hope it's a little clearer







Le jeudi 18 septembre 2014 14:05:13 UTC+2, Helton Alves a écrit :
I didn't understand very well.
would you like the image of the tutorial?

2014-09-18 9:59 GMT+01:00 Salvatore DI DIO <salvato...@gmail.com>:
Hello,

I am following a 'photo application' tutorial : http://lightbird.net/dbe/photo.html
I have created several 'albums' to insert images in.

I would like those albums beeing displayed in the admin panel
according to each user or group


Thank your for your help

regards



--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3ad874fd-9629-44e4-8cf4-0da6ac522492%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Helton Alves 
Desenvolvedor web
Graduado em Sistemas de Informação - FACIMP
Cursando Metodologia do Ensino Superior - INESPO

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e28b8164-017e-4932-8afc-f62533b6b02d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Helton Alves 
Desenvolvedor web
Graduado em Sistemas de Informação - FACIMP
Cursando Metodologia do Ensino Superior - INESPO

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6b84c3c8-9c0e-4f6e-8558-0793f55f11e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment