Customizie admin views

10 views
Skip to first unread message

jsdey

unread,
Mar 23, 2012, 10:03:57 AM3/23/12
to Django users
I have a project photos that has a model Album. Admin (/admin/photos/
album/ page has a button "Add Album". I want to write a custom page
for that action but can't find the view that does the processing. Any
guidance would be appreciated. Thanks.

John

dummyman dummyman

unread,
Mar 24, 2012, 1:23:42 PM3/24/12
to django...@googlegroups.com
hi

u can override response_change method
def response_change(self,request,obj):


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


John S. Dey

unread,
Mar 24, 2012, 2:10:06 PM3/24/12
to django...@googlegroups.com
Thanks for the tip.  I'm new to django/python and need a little bit of coaching.  I found the response_change method in options.py as part of the ModelAdmin class.  What is the best way to override?  Could I create a class that inherits ModelAdmin and place the modified response_change in it.  Would this code be added to my admin.py residing in my app directory?  Or could I bring the whole class down in insert in my admin.py?  Any guidance would be much appreciated.  Thanks 

John

dummyman dummyman

unread,
Mar 24, 2012, 2:23:07 PM3/24/12
to django...@googlegroups.com
in admin.py

# import your model
from django.contrib import admin


class MyAdmin(admin.ModelAdmin):
    def response_change(self,request,obj):
result = super(MyAdmin, self).response_change(request, obj)
                document=Yourmodel.objects.get(idcontent=obj.idcontent)
         #rest of the code

John S. Dey

unread,
Mar 24, 2012, 2:31:15 PM3/24/12
to django...@googlegroups.com
Thanks so very much for the advise.  I'll give it a try.
Reply all
Reply to author
Forward
0 new messages