jet-admin / jet-django

Jet Bridge (Django) for Jet Admin – Admin panel framework for your application

Home Page:https://app.jetadmin.io/demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Display GenericRelation

Vadorequest opened this issue · comments

I have the following model in models.py

from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from jsonfield import JSONField


class Org(models.Model):
  name = models.SlugField(
    help_text="Name which references the organisation (unique)",
    max_length=50,
    unique=True,
  )
  label = models.CharField(
    help_text="Displayed label",
    max_length=100,
    null=False,
    blank=False,
  )
  logo = JSONField(
    help_text="Logo (JSON). All fields are required<br />"
              "Structure is likely to evolve and therefore stored as JSON for the sake of simplicity",
    default='',
    null=False,
    blank=False,
  )
  apps = JSONField(
    help_text="Applications configuration (JSON)<br />"
              "Structure is likely to evolve and therefore stored as JSON for the sake of simplicity",
    default='',
    null=False,
    blank=False,
  )
  # Reverse generic relation - XXX See https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#reverse-generic-relations
  student_solutions = GenericRelation('student_solution.StudentSolution')

  class Meta:
    # https://docs.djangoproject.com/en/2.1/ref/models/options/#django.db.models.Options.db_table
    db_table = "tfp_organisations"
    verbose_name = 'Organisation'
    verbose_name_plural = 'Organisations'

    # https://docs.djangoproject.com/en/2.1/ref/models/options/#indexes
    # indexes = [
    #   models.Index(fields=['name', 'name']),
    # ]

  def __str__(self):
    return self.label

The relevant line is

student_solutions = GenericRelation('student_solution.StudentSolution')

In the JET Admin I don't see the relation at all:

image

I don't see it either when trying to customise the interface:

image

I would expect the StudentSolution relationship to be displayed. I guess this connector doesn't have such feature at this time, but it could be handy.