Skip to content
Advertisement

Paginator for inline models in django admin

I have this simple django model consisting of an sensor and values for the specific sensor. The number of values per Pyranometer is high (>30k). Is it somehow possible to paginate PyranometerValues by a specific day or generell apply a paginator to the admin inline view?

class Pyranometer(models.Model):
     name = models.CharField(max_length=75)                                                                             

class PyranometerValues(models.Model):                                                                                 
    timestamp = models.DateTimeField()
    value = models.DecimalField(max_digits=10,decimal_places=6)                                                        
    sensor = models.ForeignKey('Pyranometer')      

Advertisement

Answer

Have you checked raw_id_fields attribute? I think you might find it useful.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement