Example #1
0
 def save(self, **kwargs):
     
     self.domain = doormat.clean_domain(self.domain)
     self.path = doormat.clean_path(self.path)
     
     if not self.is_enabled:
         self.last_published = None
     elif self.is_enabled and self.last_published is None:
         self.last_published = datetime.datetime.utcnow()
     
     super(DoorMat, self).save(**kwargs)
Example #2
0
 def find_one(self, domain, path=''):
     
     # prep parameters
     domain = doormat.clean_domain(domain)
     path = doormat.clean_path(path)
     
     # get basic queryset
     qs = DoorMat.objects.filter(domain=domain, is_enabled=True)
     
     for dm in qs.order_by('-path'):
         if path.startswith(dm.path):
             return dm