예제 #1
0
def serialize_fully():
    index = 0

    while index < len(serialize_me):
        for field in get_fields(serialize_me[index]):
            if isinstance(field, models.ForeignKey):
                add_to_serialize_list(
                    [serialize_me[index].__getattribute__(field.name)])

        index += 1

    serialize_me.reverse()
예제 #2
0
def serialize_fully():
    index = 0

    while index < len(serialize_me):
        for field in get_fields(serialize_me[index]):
            if isinstance(field, models.ForeignKey):
                add_to_serialize_list(
                    [serialize_me[index].__getattribute__(field.name)])

        index += 1

    serialize_me.reverse()
예제 #3
0
    def test_get_fields(self):
        obj = lambda: None
        obj._meta = lambda: None
        obj._meta.fields = ['foo']

        self.assertEqual(['foo'], get_fields(obj))
    def test_get_fields(self):
        obj = lambda: None
        obj._meta = lambda: None
        obj._meta.fields = ['foo']

        self.assertEqual(['foo'], get_fields(obj))