Beispiel #1
0
 def get_cluster_by_name(self, cluster_name, sector_name):
     """
     Looks up a cluster in a given sector.  Returns None if none found.
     @param cluster_name: The cluster's name.
     @param sector_name: The sector's name.
     """
     return single_row_or_none(
         self.filter(
             node_type__name=NodeType.TAG_CLUSTER,
             name=cluster_name,
             parents__name=sector_name,
         ))
Beispiel #2
0
 def get_cluster(self, clusterId):
     """
     Returns the give cluster.
     """
     return single_row_or_none(
         self.filter(id=clusterId, node_type__name=NodeType.TAG_CLUSTER))
Beispiel #3
0
 def getFromAbbreviation(self, abbr):
     """
     Returns the society with the given abbreviation, or None.
     """
     return single_row_or_none(self.filter(abbreviation=abbr))
Beispiel #4
0
 def getFromName(self, name):
     """
     Returns the society with the given name, or None.
     """
     return single_row_or_none(self.filter(name=name))
Beispiel #5
0
def get_user_from_email(email):
    return single_row_or_none(User.objects.filter(email=email))
Beispiel #6
0
def get_user_from_username(username):
    return single_row_or_none(User.objects.filter(username=username))