Example #1
0
 def status(self, **kwargs):
     _kwargs = kwargs
     _kwargs.update({'user': self.user.user})
     if self.restriction in restriction_pool.keys():
         return restriction_pool[self.restriction].status(**_kwargs)
     else:
         return False
Example #2
0
 def status(self, **kwargs):
     _kwargs = kwargs
     _kwargs.update({'user': self.user.user})
     if self.restriction in restriction_pool.keys():
         return restriction_pool[self.restriction].status(**_kwargs)
     else:
         return False
Example #3
0
 def status(self, **kwargs):
     _kwargs = kwargs
     _kwargs.update({'user': self.user})
     res = []
     for item in self.restrictions.all():
         if item.restriction in restriction_pool.keys():
           res.append(restriction_pool[item.restriction].status(**_kwargs))
     return all(res)
Example #4
0
class RestrictionModel(models.Model):
    CHOICES = [(x, x) for x in restriction_pool.keys()]
    restriction = models.CharField(choices=CHOICES,
                                   default=CHOICES[0][0],
                                   max_length=100)
    user = models.ForeignKey(RegularUserModel,
                             related_name='restrictions',
                             null=True,
                             blank=False)

    def __str__(self):
        return self.restriction

    def status(self, **kwargs):
        _kwargs = kwargs
        _kwargs.update({'user': self.user.user})
        if self.restriction in restriction_pool.keys():
            return restriction_pool[self.restriction].status(**_kwargs)
        else:
            return False