Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Display GenericRelation #8

Open
Vadorequest opened this issue Mar 7, 2019 · 0 comments
Open

[Feature] Display GenericRelation #8

Vadorequest opened this issue Mar 7, 2019 · 0 comments

Comments

@Vadorequest
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant