aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/models.py
diff options
context:
space:
mode:
authorGitHub Merge Button2011-07-08 14:59:57 -0700
committerGitHub Merge Button2011-07-08 14:59:57 -0700
commit3a4f39497be899218ad8d3638bbee38f455782c5 (patch)
treeebbe6a68174746a1e15727c5ef92d0e685b068f8 /djangorestframework/tests/models.py
parent3b2e70dd3a3bbac0fb5318329483b4a4eb20410a (diff)
parent91b9d0b2a3fa55ff163f64bc689a59ca01cff8bb (diff)
downloaddjango-rest-framework-3a4f39497be899218ad8d3638bbee38f455782c5.tar.bz2
Merge 91b9d0b2a3fa55ff163f64bc689a59ca01cff8bb into 3b2e70dd3a3bbac0fb5318329483b4a4eb20410a
Diffstat (limited to 'djangorestframework/tests/models.py')
-rw-r--r--djangorestframework/tests/models.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/djangorestframework/tests/models.py b/djangorestframework/tests/models.py
new file mode 100644
index 00000000..61da1d45
--- /dev/null
+++ b/djangorestframework/tests/models.py
@@ -0,0 +1,28 @@
+from django.db import models
+from django.contrib.auth.models import Group
+
+class CustomUser(models.Model):
+ """
+ A custom user model, which uses a 'through' table for the foreign key
+ """
+ username = models.CharField(max_length=255, unique=True)
+ groups = models.ManyToManyField(
+ to=Group, blank=True, null=True, through='UserGroupMap'
+ )
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('custom_user', (), {
+ 'pk': self.id
+ })
+
+
+class UserGroupMap(models.Model):
+ user = models.ForeignKey(to=CustomUser)
+ group = models.ForeignKey(to=Group)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('user_group_map', (), {
+ 'pk': self.id
+ }) \ No newline at end of file