Django admin not show all record of tables

Hi all,

I need to solve an issue is very strange. The admin interface show all record of a table but not the last inserted. For example the last inserted string is 6760 and when insert the 6761 the application tell me there is and is true in the db is present but not in the web table.

I have registered the model with admin.site.register(practice) but non show ll record of the table.

Please is very urgent.
Thanks for all replay

The first thing to do would be to check the database directly. Use the database’s tool to examine the table to see if the data you’re expecting to see is actually there.

Also, it might help if you talked about the specific situation and not try to generalize or summarize it. Post the actual model you are trying to look at and identify the data you are expecting to see but aren’t. Then, you could post the output of a database query showing that the data you are expecting to see is actually in the database.

the data in the database are there, but the admin user interface does not display them it stops at 4 records before. I don’t know why, but it doesn’t show them. Are there any limitations in the admin’s model query?
this is the model:

class practice(models.Model):
practice_number = models.IntegerField(unique=True)

def __str__(self):
    practice_number = str(self.practice_number)
    return practice_number

def __unicode__(self):
    return self.practice_number

the problem is related to practice_number field not show all but all minus 4 without reason

The number of instances being shown on a page is configurable. Do you have more instances of that model than what are shown on a page?

How many instances are being shown?
(At the top of the list, next to the action bar, it shows " __ of __ selected". What are the numbers shown there?)

Are you seeing the pagination selection at the bottom of the page?

Yes i see 0-100 selected but I have pagination. I don’t modify the page of a model so is default only i wrote is the model i posted before

How many instances of this model do you have?

What does the pagination show you at the bottom of the page?

One instance for admin interface. The pagination show me the number of the page anf total of practice 623, but now the problem is for only a specific number of practice: 6760, 6761, 6762 not show but 6763 is showing. I don’t what is different

I’m sorry but the image i can’t send because the application is on premis of customer and is very complex to connect

Maybe you missed admin config? Or you have some custom action to filter them?

Just do something like this:

This issue can be caused by several factors:

  1. Caching Issues: Browser cache may prevent the latest data from being displayed. Try clearing the browser cache or refreshing the page (Shift+F5 or Shift+Reload).
  2. Database Synchronization Issues: Ensure your database and Django models are synchronized. Run makemigrations and migrate commands to check for unsynchronized data.
  3. Model Registration Issue: Check if your model is correctly registered. Make sure you have admin.site.register(Practice) in your admin.py file.
  4. Caching Mechanism: Django’s caching mechanism may prevent the latest data from being displayed. Check if you have any caching mechanisms enabled, such as Cacheops or Django Cache, and try clearing the cache.
  5. Browser Issues: Try using a different browser or device to access the Django admin interface to see if the problem persists.

Troubleshooting Steps

  1. Clear Cache: Clear your browser cache and refresh the page.
  2. Synchronize Database: Run the following commands to synchronize the database:
    python manage.py makemigrations
    python manage.py migrate
    
  3. Check Model Registration: Ensure your model is correctly registered in the admin.py file:
    from django.contrib import admin
    from yourapp.models import Practice
    
    admin.site.register(Practice)
    
  4. Check Caching Mechanism: If you are using any caching mechanisms, try clearing the cache.
  5. Use Different Browser: Try using a different browser or device to access the Django admin interface.

These steps may help you solve the problem

Also, check if you’ve redefined the objects property on the model with a custom Manager. I think that’s what is used to display the Admin listing.

I found the mistery the number of practice is real into db and correct created but in primary time to development so. The mistake is appear because the number of practice is just create and the order of the table in the admin interface is not for number of practice but in time order. How can I order the table for number practice?

You need ModelAdmin.ordering.