Question

I'm using the last svn revision of grappelli and rev 11840 of django (before multidatabases and stuff), and i'm trying to use generic relations in the admin, but doesn't work,

The model:

class AutorProyectoLey(DatedModel):
    tipo_autor = models.ForeignKey(ContentType)
    autor_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('tipo_autor', 'autor_id')
    proyecto_ley = models.ForeignKey(ProyectoLey)

The admin:

class AutorInline(GenericInlineModelAdmin):
    model = AutorProyectoLey
    allow_add = True
    ct_field = 'tipo_autor'
    ct_fk_field = 'autor_id'
    classes = ('collapse-open',)

And i put this model of var inlines in another adminmodel, but the html render is :

       <!-- Inlines -->






       <!-- Submit-Row -->
Was it helpful?

Solution

Is necesary for grappelli the fields names content_type and object_id in other way doesn't work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top