I have Admin.py as follows .
from django.contrib import admin
from do.models import *
class NewsAdmin(admin.ModelAdmin):
list_display=['time','message']
admin.site.register(do_model,NewsAdmin)
I while i go to the admin panel and go to the do_models , it is showing me huge lots of data . I dont want to see all data from the beginning date , is it possible that i can limit data till 20 or 30 lines of data and rest of data should not be shown like paginating so that it load easily . Kindly suggest .
The Django admin is a powerful built-in tool giving you the ability to create, update, and delete objects in your database using a web interface. You can customize the Django admin to do almost anything you want.
Django admin allows access to users marked as is_staff=True . To disable a user from being able to access the admin, you should set is_staff=False . This holds true even if the user is a superuser. is_superuser=True .
It's just a way for you to be able to group the fields on a Model Admin Page. Just implement the example in the documentation and it should become apparent for you.
To login to the site, open the /admin URL (e.g. http://127.0.0.1:8000/admin ) and enter your new superuser userid and password credentials (you'll be redirected to the login page, and then back to the /admin URL after you've entered your details).
class NewsAdmin(admin.ModelAdmin):
list_display=['time','message']
list_per_page = 400
admin.site.register(do_model,NewsAdmin)
you can use list_per_page
to limit the number of rows shown in a single page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With