0

I am trying to include form entries from django-forms-builder as a (generic, if necessary) inline in the django admin.

However, when I do this, my form fields are not showing up, only the date and time are, the only fields defined in the abstract base class.


UPDATE - The above is quite understandable given that the fields are dynamically injected. django-forms-builder sublcasses the abstract base class, creating FormEntry, Form, FormField models.

Essentially, I need to be able to retrieve the actual FormEntry of a given type of Form.


UPDATE 2 - Possibly relevant and helpful links:

Override ModelAdmin.form?

or... create a custom AJAX-hackish solution


models.py

from forms_builder.forms import models as fmodels   

class FormEntry(fmodels.<s>Abstract</s>FormEntry):
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id') 
    pass

admin.py

class FormEntryInline(generic.GenericStackedInline):
    model = FormEntry 

I believe that, since the source for django-forms-builder relies on abstract classes, I may not be subclassing properly. Do I need to define a queryset? Any help would be appreciated.

Community
  • 1
  • 1
snakesNbronies
  • 3,619
  • 9
  • 44
  • 73

1 Answers1

0

You have the crux of the issue in your "UPDATE" text - the entry fields are entirely dynamic, and they're not backed by a fixed Django model, so using standard admin features like inlines and such isn't possible.

However to address this general requirement, each form in the admin contains a custom "export" view, which can be used for viewing or exporting form entries. It even contains an advanced filtering form, so in some regards it's actually better than regular Django admin features.

Steve
  • 1,726
  • 10
  • 16