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
I have the following model in
models.py
The relevant line is
In the JET Admin I don't see the relation at all:
I don't see it either when trying to customise the interface:
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.