Django - does model need own table if it inherits solely to change the manager? -
i've read thread deals issue of making django comments use select_related() on “user” field thereby reducing needless sql queries.
the suggestion best create own comment model , override manager used.
this have:
#models.py class lightcommentmanager(commentmanager): def get_query_set(self): qs = (super(commentmanager, self).get_query_set().select_related('user')) return qs class lightcomment(comment): objects = lightcommentmanager() class meta: managed = false
this works fine when syncdb, django still creates table lightcomment. need have table if i'm changing manager, , why django create if managed set false?
thanks in advance,
for start, inner class should called meta
, not meta
.
but rather managed = false
, should using proxy = true
signify creating proxy model rather real model.
Comments
Post a Comment