summaryrefslogtreecommitdiff
path: root/tests/djapp/models.py
diff options
context:
space:
mode:
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