class Account(models.Model): """ On a dedicated appliance, there will only be one account for the people who bought the appliance. In other situations there might be more than one account, eg, a hosted version (wikipbx.com selling hosted accts to the masses) """ # this will be the sofia profile name name = models.CharField(maxlength=50) server = models.ForeignKey('Server') admins = models.ManyToManyField('UserProfile', related_name="admins") enabled = models.BooleanField(default=True) ext_rtp_ip = models.CharField(maxlength=50) ext_sip_ip = models.CharField(maxlength=50) # if set to true, lets anything register accept_blind_reg = models.BooleanField(default=False) sip_port = models.PositiveIntegerField() class Meta: unique_together = (("sip_port", "ext_sip_ip"),) def short_name(self): numchars = 10 if len(self.name) <= numchars: return self.name else: return "%s.." % self.name[:8]