Initial subdomain implementation

This commit is contained in:
cuom1999 2023-01-23 20:36:44 -06:00
parent dea24f7f71
commit 1628e63084
17 changed files with 194 additions and 46 deletions

View file

@ -33,6 +33,7 @@ class Organization(models.Model):
max_length=128,
verbose_name=_("organization slug"),
help_text=_("Organization name shown in URL"),
unique=True,
)
short_name = models.CharField(
max_length=20,
@ -339,6 +340,16 @@ class Profile(models.Model):
ret.add(self.username)
return ret
def can_edit_organization(self, org):
if not self.user.is_authenticated:
return False
profile_id = self.id
return (
org.admins.filter(id=profile_id).exists()
or org.registrant_id == profile_id
or self.user.is_superuser
)
class Meta:
permissions = (
("test_site", "Shows in-progress development stuff"),