Customise admin view

30 views
Skip to first unread message

Salvatore DI DIO

unread,
Sep 18, 2014, 4:59:40 AM9/18/14
to django...@googlegroups.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



Helton Alves

unread,
Sep 18, 2014, 8:05:13 AM9/18/14
to django...@googlegroups.com
I didn't understand very well.
would you like the image of the tutorial?

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

Salvatore DI DIO

unread,
Sep 18, 2014, 9:17:14 AM9/18/14
to django...@googlegroups.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

Helton Alves

unread,
Sep 18, 2014, 9:44:44 AM9/18/14
to django...@googlegroups.com
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)


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

Salvatore DI DIO

unread,
Sep 18, 2014, 11:13:25 AM9/18/14
to django...@googlegroups.com
That's great
Thank you very very much Helton
Reply all
Reply to author
Forward
0 new messages