wip: Limits and resellers

* refactoring, limits are working pretty well
* domain admins can now create domains (under control) when the limits extension is enabled

see #105
This commit is contained in:
Antoine Nguyen
2012-01-24 11:23:31 +01:00
parent 3681bb4198
commit 1c51e97179
18 changed files with 300 additions and 88 deletions
+9
View File
@@ -16,6 +16,13 @@ reseller_limits_tpl = [
class LimitsPool(models.Model):
user = models.OneToOneField(User)
def create_limits(self):
for lname in reseller_limits_tpl:
l = Limit()
l.name = lname
l.pool = self
l.save()
def getcurvalue(self, lname):
l = self.limit_set.get(name=lname)
return l.curvalue
@@ -56,3 +63,5 @@ class Limit(models.Model):
maxvalue = models.IntegerField(default=-2)
pool = models.ForeignKey(LimitsPool)
class Meta:
unique_together = (("name", "pool"),)