예제 #1
0
class FakeModelB(Model):
    collection = Collection("fake_model_b")
    verbose_name = "fake model b"

    id = fields.IntegerField()

    meeting_id = fields.RelationField(
        to={Collection("meeting"): "fake_model_b_ids"},
        required=True,
    )

    fake_model_a_oo = fields.RelationField(
        to={Collection("fake_model_a"): "fake_model_b_oo"})
    fake_model_a_mo = fields.RelationListField(
        to={Collection("fake_model_a"): "fake_model_b_om"})
    fake_model_a_mm = fields.RelationListField(
        to={Collection("fake_model_a"): "fake_model_b_mm"})
    fake_model_a_generic_oo = fields.GenericRelationField(
        to={Collection("fake_model_a"): "fake_model_b_generic_oo"}, )
    fake_model_a_generic_mo = fields.GenericRelationListField(
        to={Collection("fake_model_a"): "fake_model_b_generic_om"}, )
    fake_model_a_generic_mm = fields.GenericRelationListField(
        to={Collection("fake_model_a"): "fake_model_b_generic_mm"}, )

    structured_relation_field = fields.RelationField(
        to={Collection("fake_model_a"): "fake_model_b_$_ids"}, )

    fake_model_c_ids = fields.RelationListField(
        to={Collection("fake_model_c"): "foreign_key_field"}, )
예제 #2
0
class FakeModelEFB(Model):
    collection = Collection("fake_model_ef_b")
    verbose_name = "fake model for equal field check b"
    id = fields.IntegerField()

    reference_field = fields.RelationField(to=Collection("fake_model_ef_a"),
                                           related_name="b_id")

    c_id = fields.RelationField(
        to=Collection("fake_model_ef_c"),
        related_name="b_id",
        equal_fields="reference_field",
    )
    c_ids = fields.RelationListField(
        to=Collection("fake_model_ef_c"),
        related_name="b_ids",
        equal_fields="reference_field",
    )
    c_generic_id = fields.GenericRelationField(
        to=[Collection("fake_model_ef_c")],
        related_name="b_generic_id",
        equal_fields="reference_field",
    )
    c_generic_ids = fields.GenericRelationListField(
        to=[Collection("fake_model_ef_c")],
        related_name="b_generic_ids",
        equal_fields="reference_field",
    )
예제 #3
0
class FakeModelEFC(Model):
    collection = Collection("fake_model_ef_c")
    verbose_name = "fake model for equal field check c"
    id = fields.IntegerField()

    meeting_id = fields.RelationField(
        to={Collection("fake_model_ef_a"): "c_id"})

    b_id = fields.RelationField(to={Collection("fake_model_ef_b"): "c_id"}, )
    b_ids = fields.RelationListField(
        to={Collection("fake_model_ef_b"): "c_ids"}, )
    b_generic_id = fields.GenericRelationField(
        to={Collection("fake_model_ef_b"): "c_generic_id"}, )
    b_generic_ids = fields.GenericRelationListField(
        to={Collection("fake_model_ef_b"): "c_generic_ids"}, )
예제 #4
0
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")
예제 #5
0
class FakeModelEFC(Model):
    collection = Collection("fake_model_ef_c")
    verbose_name = "fake model for equal field check c"

    reference_field = fields.RelationField(
        to=Collection("fake_model_ef_a"), related_name="c_id"
    )

    b_id = fields.RelationField(to=Collection("fake_model_ef_b"), related_name="c_id",)
    b_ids = fields.RelationListField(
        to=Collection("fake_model_ef_b"), related_name="c_ids",
    )
    b_generic_id = fields.GenericRelationField(
        to=[Collection("fake_model_ef_b")], related_name="c_generic_id",
    )
    b_generic_ids = fields.GenericRelationListField(
        to=[Collection("fake_model_ef_b")], related_name="c_generic_ids",
    )