Admin area hyperlinks to sub categories

16 views
Skip to first unread message

Swaroop Shankar V

unread,
Apr 9, 2012, 5:23:55 AM4/9/12
to django...@googlegroups.com
Hi all,
I have 2 models one is Category and another one is Book. Books will be assigned to a category. So on the admin area i want to display a link on the dashboard which will take the user to a page where all the categories will be listed. On clicking on to any of the category user should be taken to a page where the books assigned under that category is displayed. How can i accomplish the same. 

Thanks and Regards,

Swaroop Shankar V

Swaroop Shankar V

unread,
Apr 11, 2012, 9:54:59 AM4/11/12
to django...@googlegroups.com
Hi,
Could anyone provide me a solution please? Thanks

Regards,
Swaroop Shankar V

Sandro Dutra

unread,
Apr 11, 2012, 10:06:06 AM4/11/12
to django...@googlegroups.com
# File: admin.py
from django.contrib import admin
from distribute.models import Categories
(...)
class CategoriesAdmin(admin.ModelAdmin):
    list_display = ['category']
    (...)
(...)
admin.site.register(Categories, CategoriesAdmin)
(...)

2012/4/11 Swaroop Shankar V <swar...@gmail.com>

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

Sandro Dutra

unread,
Apr 11, 2012, 10:09:02 AM4/11/12
to django...@googlegroups.com

Swaroop Shankar V

unread,
Apr 14, 2012, 5:50:58 PM4/14/12
to django...@googlegroups.com
Hi Sandro,
Thanks for the link. It looks like you had provided the link to show additional options in the action drop down on the list page. This is not what am exactly looking for. I guess my question was not clear. I will try to explain it in much better way:
1) I have 2 models called Categories and Books. The book have a foreign key to Categories model, which means more than one book can be marked under a category.
2) The user is presented with a Category link on the admin dashboard
3) When the user clicks on to it he is taken to a page where all the Categories will be listed
4) The categories listed will be an hyperlinks
5) When the user clicks on to any one of the category then he is redirected to another listing page where all books under that category will be displayed. So if the cartegory is fiction then all the books which are assigned under fiction will be displayed. 

So how can i link a category to book listing page. I know that there is a filter method that i can use in books listing page but i want to implement above said approach. How can it be done? I hope i have made myself clear.

Thanks and Regards, 
 
Swaroop Shankar V
Reply all
Reply to author
Forward
0 new messages