Estoy buscando un ejemplo funcional de django mptt [cerrado]

Does anyone has a working example of django mptt. I am not able to implement it. Maybe category system. Thanks

preguntado el 30 de agosto de 12 a las 17:08

1 Respuestas

Here is my code, part of an accounting app:

from mptt.models import MPTTModel
from mptt.fields import TreeForeignKey

class Category(MPTTModel):
    ledger = models.ForeignKey(Ledger)
    parent = TreeForeignKey(
        'self', null = True, blank = True, default = None,
        related_name = 'children'
    )
    label = models.CharField(max_length = 60)

This simply follows the documentation. Which specific part goes wrong for you?

Respondido 30 ago 12, 18:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.