def setUp(self):
        reversion_api.unregister(Person)
        reversion_api.unregister(Car)
        reversion_api.unregister(Factory)
        reversion_api.register(Factory, follow=["building_ptr", "cars", "workers"])
        reversion_api.register(Car)
        reversion_api.register(Person, follow=["pets"])
        super(FactoryCarReverseRelationModelTest, self).setUp()

        test_data = TestData(verbose=False)
        self.factory = test_data.create_Factory_reverse_relation_data()
        queryset = reversion_api.get_for_object(self.factory)
        self.version_ids = queryset.values_list("pk", flat=True)
示例#2
0
    # If you work someone, its at a build, but maybe not a factory!
    workplace = models.ForeignKey(Building, related_name="workers", null=True)

    def __str__(self):
        return self.name


@python_2_unicode_compatible
class Identity(models.Model):
    id_numer = models.CharField(max_length=100)
    person = models.OneToOneField(Person, related_name='_identity')

    def __str__(self):
        return self.id_numer

reversion_api.register(Person, follow=["pets"])
reversion_api.register(Pet)


@python_2_unicode_compatible
class VariantModel(models.Model):
    """
    This model should contain all variants of all existing types,
    without the related fields.

    TODO: Add tests for all variants!
    """

    TEST_CHOICES = (
        ('a', 'alpha'),
        ('b', 'bravo'),
示例#3
0
    workplace = models.ForeignKey(Building, related_name="workers", null=True)

    def __str__(self):
        return self.name


@python_2_unicode_compatible
class Identity(models.Model):
    id_numer = models.CharField(max_length=100)
    person = models.OneToOneField(Person, related_name='_identity')

    def __str__(self):
        return self.id_numer


reversion_api.register(Person, follow=["pets"])
#reversion_api.register(Pet, follow=["person_set"])
reversion_api.register(Pet)


@python_2_unicode_compatible
class VariantModel(models.Model):
    """
    This model should contain all variants of all existing types,
    without the related fields.

    TODO: Add tests for all variants!
    """
    boolean = models.BooleanField(default=True)
    null_boolean = models.NullBooleanField()