Django admin causes high load for one model...

Posted by Joe on Stack Overflow See other posts from Stack Overflow or by Joe
Published on 2010-05-21T12:48:20Z Indexed on 2010/05/21 12:50 UTC
Read the original article Hit count: 370

In my Django admin, when I try to view/edit objects from one particular model class the memory usage and CPU rockets up and I have to restart the server. I can view the list of objects fine, but the problem comes when I click on one of the objects. Other models are fine. Working with the object in code (i.e. creating and displaying) is ok, the problem only arises when I try to view an object with the admin interface. The class isn't even particularly exotic:

class Comment(models.Model):
    user = models.ForeignKey(User)
    thing = models.ForeignKey(Thing)
    date = models.DateTimeField(auto_now_add=True)
    content = models.TextField(blank=True, null=True)
    approved = models.BooleanField(default=True)

    class Meta:
        ordering = ['-date']

Any ideas? I'm stumped. The only reason I could think of might be that the thing is quite a large object (a few kb), but as I understand it, it wouldn't get loaded until it was needed (correct?).

© Stack Overflow or respective owner

Related posts about django

Related posts about django-models