summaryrefslogtreecommitdiffstats
path: root/packages/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/models.py')
-rw-r--r--packages/models.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/models.py b/packages/models.py
new file mode 100644
index 0000000..9eff517
--- /dev/null
+++ b/packages/models.py
@@ -0,0 +1,23 @@
+from django.db import models
+from django.contrib.auth.models import User
+
+class PackageRelation(models.Model):
+ '''
+ Represents maintainership (or interest) in a package by a given developer.
+ It is not a true foreign key to packages as we want to key off
+ pkgbase/pkgname instead, as well as preserve this information across
+ package deletes, adds, and in all repositories.
+ '''
+ MAINTAINER = 1
+ WATCHER = 2
+ TYPE_CHOICES = (
+ (MAINTAINER, 'Maintainer'),
+ (WATCHER, 'Watcher'),
+ )
+ pkgbase = models.CharField(max_length=255)
+ user = models.ForeignKey(User, related_name="package_relations")
+ type = models.PositiveIntegerField(choices=TYPE_CHOICES, default=MAINTAINER)
+ class Meta:
+ unique_together = (('pkgbase', 'user', 'type'),)
+
+# vim: set ts=4 sw=4 et: