ninjaframework / ninja

Ninja is a full stack web framework for Java. Rock solid, fast and super productive.
http://www.ninjaframework.org
Apache License 2.0
1.91k stars 521 forks source link

Exclude field from depths (nested relation) on create_schema function #756

Closed Abdoulrasheed closed 1 year ago

Abdoulrasheed commented 1 year ago

Is there a way to exclude a field from a nested relation using the create_schema function? Or is there another way to generate a schema that excludes a field from a nested relation?

Consider the following models:

class Allergy(models.Model):
    name = models.CharField(max_length=100)

class Profile(models.Model):
    allergies = models.ManyToManyField(Allergy, blank=True, null=True)

ProfileInput = create_schema(
    Profile,
    depth=1,
    exclude=["allergies__id"] # I want something like this or allergies.id
    )

Is there a way to do this at the moment using create_schema or some other means?