summaryrefslogtreecommitdiff
path: root/tests/djapp/models.py
diff options
context:
space:
mode:
authorOndřej Nový <novy@ondrej.org>2016-02-14 19:26:09 +0100
committerOndřej Nový <novy@ondrej.org>2016-02-14 19:26:09 +0100
commita85231280accdfec8ef9cf67213ff706eb242889 (patch)
treec84bb817ccf5bae224e473bb15959a4fb97d41ba /tests/djapp/models.py
parentd92aeedcf27326270cb3dcd8b780566728a489a9 (diff)
parent41560aa54e83fe539c0a5a1935bcaaf6363a522c (diff)
downloadfactory-boy-a85231280accdfec8ef9cf67213ff706eb242889.tar
factory-boy-a85231280accdfec8ef9cf67213ff706eb242889.tar.gz
Merge tag '2.6.1' into debian/unstable
Release of factory_boy 2.6.1
Diffstat (limited to 'tests/djapp/models.py')
-rw-r--r--tests/djapp/models.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/djapp/models.py b/tests/djapp/models.py
index 9b21181..cadefbc 100644
--- a/tests/djapp/models.py
+++ b/tests/djapp/models.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright (c) 2011-2013 Raphaël Barrois
+# Copyright (c) 2011-2015 Raphaël Barrois
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -68,6 +68,15 @@ class StandardSon(StandardModel):
pass
+class PointedModel(models.Model):
+ foo = models.CharField(max_length=20)
+
+
+class PointingModel(models.Model):
+ foo = models.CharField(max_length=20)
+ pointed = models.OneToOneField(PointedModel, related_name='pointer', null=True)
+
+
WITHFILE_UPLOAD_TO = 'django'
WITHFILE_UPLOAD_DIR = os.path.join(settings.MEDIA_ROOT, WITHFILE_UPLOAD_TO)
@@ -79,6 +88,7 @@ if Image is not None: # PIL is available
class WithImage(models.Model):
animage = models.ImageField(upload_to=WITHFILE_UPLOAD_TO)
+ size = models.IntegerField(default=0)
else:
class WithImage(models.Model):
@@ -87,3 +97,27 @@ else:
class WithSignals(models.Model):
foo = models.CharField(max_length=20)
+
+
+class CustomManager(models.Manager):
+
+ def create(self, arg=None, **kwargs):
+ return super(CustomManager, self).create(**kwargs)
+
+
+class WithCustomManager(models.Model):
+
+ foo = models.CharField(max_length=20)
+
+ objects = CustomManager()
+
+
+class AbstractWithCustomManager(models.Model):
+ custom_objects = CustomManager()
+
+ class Meta:
+ abstract = True
+
+
+class FromAbstractWithCustomManager(AbstractWithCustomManager):
+ pass