Merge branch 'master' of github.com:glic3rinu/django-orchestra

Conflicts:
	TODO.md
This commit is contained in:
Marc Aymerich 2015-03-02 10:38:07 +00:00
commit 04ab19379e
3 changed files with 37 additions and 18 deletions

16
TODO.md
View File

@ -188,3 +188,19 @@ Multi-tenant WebApps
* username maximum as group user in UNIX
* forms autocomplete="off", doesn't work in chrome
ln -s /proc/self/fd /dev/fd
* http-https/https-only/http-only
POST INSTALL
------------
* Generate a password-less ssh key, and copy it to the servers you want to orchestrate.
ssh-keygen
ssh-copy-id root@<server-address>

View File

@ -50,6 +50,26 @@ class Domain(models.Model):
def subdomains(self):
return Domain.objects.filter(name__regex='\.%s$' % self.name)
def clean(self):
self.name = self.name.lower()
def save(self, *args, **kwargs):
""" create top relation """
update = False
if not self.pk:
top = self.get_top()
if top:
self.top = top
self.account_id = self.account_id or top.account_id
else:
update = True
super(Domain, self).save(*args, **kwargs)
if update:
for domain in self.subdomains.exclude(pk=self.pk):
# queryset.update() is not used because we want to trigger backend to delete ex-topdomains
domain.top = self
domain.save(update_fields=['top'])
def get_description(self):
if self.is_top:
num = self.subdomains.count()
@ -167,23 +187,6 @@ class Domain(models.Model):
value=record.value
)
return result
def save(self, *args, **kwargs):
""" create top relation """
update = False
if not self.pk:
top = self.get_top()
if top:
self.top = top
self.account_id = self.account_id or top.account_id
else:
update = True
super(Domain, self).save(*args, **kwargs)
if update:
for domain in self.subdomains.exclude(pk=self.pk):
# queryset.update() is not used because we want to trigger backend to delete ex-topdomains
domain.top = self
domain.save(update_fields=['top'])
class Record(models.Model):

View File

@ -46,7 +46,7 @@ class Command(BaseCommand):
'server {\n'
' listen 80;\n'
' listen [::]:80 ipv6only=on;\n'
' rewrite ^/$ /admin;\n'
' rewrite ^/$ /admin/;\n'
' client_max_body_size 500m;\n'
' location / {\n'
' uwsgi_pass unix:///var/run/uwsgi/app/%(project_name)s/socket;\n'