Exemple #1
0
class FakeModelCRD(Model):
    collection = Collection("fake_model_cr_d")
    verbose_name = "fake model for create relation d"
    id = fields.IntegerField()

    name = fields.CharField()
    fake_model_cr_c_ids = fields.RelationListField(
        to={Collection("fake_model_cr_c"): "fake_model_cr_d_id"},
        required=True)
class FakeModel(Model):
    """
    Fake Model for testing purposes.
    """

    collection = Collection("fake_model")
    verbose_name = "fake_model"

    id = fields.IntegerField(required=True)
    text = fields.CharField(
        required=True,
        constraints={"description": "The text of this fake model."})
    fake_model_2_ids = fields.RelationListField(to=Collection("fake_model_2"),
                                                related_name="relation_field")
    fake_model_2_generic_ids = fields.GenericRelationListField(
        to=[Collection("fake_model_2")], related_name="generic_relation_field")