Moved apps to contrib

This commit is contained in:
Marc Aymerich 2015-04-05 10:46:24 +00:00
parent 1ff4e05819
commit 10d2f7f247
307 changed files with 553 additions and 568 deletions

14
TODO.md
View File

@ -282,13 +282,10 @@ from django.utils import translation
translation.activate('ca')
ugettext("Description")
* saas validate_creation generic approach, for all backends. standard output
* html code x: × for bill line verbose quantity
* periodic task to cleanup backendlogs, monitor data and metricstorage
* create orchestrate databases.Database pk=1 -n --dry-run | --noinput --action save (default)|delete --backend name (limit to this backend) --help
@ -301,12 +298,10 @@ celery max-tasks-per-child
* make base home for systemusers that ara homed into main account systemuser, and prevent shell users to have nested homes (if nnot implemented already)
* autoscale celery workers http://docs.celeryproject.org/en/latest/userguide/workers.html#autoscaling
* webapp has_website list filter
glic3rinu's django-fluent-dashboard
* gevent is not ported to python3 :'(
* uwsgi python3
@ -322,13 +317,6 @@ https://code.djangoproject.com/ticket/24576
* read https://docs.djangoproject.com/en/dev/releases/1.8/ and fix deprecation warnings
* remove admin object links , like contents webapps
* SaaS and WebApp fieldsets, and helptexts !
* SaaS and WebApp types and services fieldsets, and helptexts !
* remove all six stuff "from django.utils.six.moves import input"
* replace make_option in management commands
* rename apps to contrib find . -type f -name "*py"|xargs grep apps | grep -v 'orchestra\.apps\.'
* replace staticcheck by run(flake8 {orchestra,project} | grep -v "W293\|E501")
* rename utils.system to utils.sys

View File

@ -41,10 +41,10 @@ def get_services():
def get_accounts():
childrens=[]
if isinstalled('orchestra.apps.payments'):
if isinstalled('orchestra.contrib.payments'):
url = reverse('admin:payments_transactionprocess_changelist')
childrens.append(items.MenuItem(_("Transaction processes"), url))
if isinstalled('orchestra.apps.issues'):
if isinstalled('orchestra.contrib.issues'):
url = reverse('admin:issues_ticket_changelist')
childrens.append(items.MenuItem(_("Tickets"), url))
for model, options in accounts.get().items():
@ -59,12 +59,12 @@ def get_accounts():
def get_administration_items():
childrens = []
if isinstalled('orchestra.apps.services'):
if isinstalled('orchestra.contrib.services'):
url = reverse('admin:services_service_changelist')
childrens.append(items.MenuItem(_("Services"), url))
url = reverse('admin:plans_plan_changelist')
childrens.append(items.MenuItem(_("Plans"), url))
if isinstalled('orchestra.apps.orchestration'):
if isinstalled('orchestra.contrib.orchestration'):
route = reverse('admin:orchestration_route_changelist')
backendlog = reverse('admin:orchestration_backendlog_changelist')
server = reverse('admin:orchestration_server_changelist')
@ -73,7 +73,7 @@ def get_administration_items():
items.MenuItem(_("Backend logs"), backendlog),
items.MenuItem(_("Servers"), server),
]))
if isinstalled('orchestra.apps.resources'):
if isinstalled('orchestra.contrib.resources'):
resource = reverse('admin:resources_resource_changelist')
data = reverse('admin:resources_resourcedata_changelist')
monitor = reverse('admin:resources_monitordata_changelist')
@ -82,10 +82,10 @@ def get_administration_items():
items.MenuItem(_("Data"), data),
items.MenuItem(_("Monitoring"), monitor),
]))
if isinstalled('orchestra.apps.miscellaneous'):
if isinstalled('orchestra.contrib.miscellaneous'):
url = reverse('admin:miscellaneous_miscservice_changelist')
childrens.append(items.MenuItem(_("Miscellaneous"), url))
if isinstalled('orchestra.apps.issues'):
if isinstalled('orchestra.contrib.issues'):
url = reverse('admin:issues_queue_changelist')
childrens.append(items.MenuItem(_("Ticket queues"), url))
if isinstalled('djcelery'):

View File

@ -1,4 +0,0 @@
from .backends import ServiceMonitor
default_app_config = 'orchestra.apps.resources.apps.ResourcesConfig'

View File

@ -36,7 +36,7 @@ MEDIA_URL = '/media/'
ALLOWED_HOSTS = '*'
# Set this to True to wrap each HTTP request in a transaction on this database.
# ATOMIC REQUESTS do not wrap middlewares (orchestra.apps.orchestration.middlewares.OperationsMiddleware)
# ATOMIC REQUESTS do not wrap middlewares (orchestra.contrib.orchestration.middlewares.OperationsMiddleware)
ATOMIC_REQUESTS = False
@ -49,7 +49,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware',
'orchestra.core.caches.RequestCacheMiddleware',
# also handles transations, ATOMIC_REQUESTS does not wrap middlewares
'orchestra.apps.orchestration.middlewares.OperationsMiddleware',
'orchestra.contrib.orchestration.middlewares.OperationsMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
@ -69,25 +69,25 @@ TEMPLATE_CONTEXT_PROCESSORS =(
INSTALLED_APPS = (
# django-orchestra apps
'orchestra',
'orchestra.apps.accounts',
'orchestra.apps.contacts',
'orchestra.apps.orchestration',
'orchestra.apps.domains',
'orchestra.apps.systemusers',
'orchestra.apps.mailboxes',
'orchestra.apps.lists',
'orchestra.apps.webapps',
'orchestra.apps.websites',
'orchestra.apps.databases',
'orchestra.apps.vps',
'orchestra.apps.saas',
'orchestra.apps.issues',
'orchestra.apps.services',
'orchestra.apps.plans',
'orchestra.apps.orders',
'orchestra.apps.miscellaneous',
'orchestra.apps.bills',
'orchestra.apps.payments',
'orchestra.contrib.accounts',
'orchestra.contrib.contacts',
'orchestra.contrib.orchestration',
'orchestra.contrib.domains',
'orchestra.contrib.systemusers',
'orchestra.contrib.mailboxes',
'orchestra.contrib.lists',
'orchestra.contrib.webapps',
'orchestra.contrib.websites',
'orchestra.contrib.databases',
'orchestra.contrib.vps',
'orchestra.contrib.saas',
'orchestra.contrib.issues',
'orchestra.contrib.services',
'orchestra.contrib.plans',
'orchestra.contrib.orders',
'orchestra.contrib.miscellaneous',
'orchestra.contrib.bills',
'orchestra.contrib.payments',
# Third-party apps
'django_extensions',
@ -111,7 +111,7 @@ INSTALLED_APPS = (
'django.contrib.admin.apps.SimpleAdminConfig',
# Last to load
'orchestra.apps.resources',
'orchestra.contrib.resources',
)
@ -144,29 +144,29 @@ FLUENT_DASHBOARD_APP_GROUPS = (
# Services group is generated by orchestra.admin.dashboard
('Accounts', {
'models': (
'orchestra.apps.accounts.models.Account',
'orchestra.apps.contacts.models.Contact',
'orchestra.apps.orders.models.Order',
'orchestra.apps.plans.models.ContractedPlan',
'orchestra.apps.bills.models.Bill',
# 'orchestra.apps.payments.models.PaymentSource',
'orchestra.apps.payments.models.Transaction',
# 'orchestra.apps.payments.models.TransactionProcess',
'orchestra.apps.issues.models.Ticket',
'orchestra.contrib.accounts.models.Account',
'orchestra.contrib.contacts.models.Contact',
'orchestra.contrib.orders.models.Order',
'orchestra.contrib.plans.models.ContractedPlan',
'orchestra.contrib.bills.models.Bill',
# 'orchestra.contrib.payments.models.PaymentSource',
'orchestra.contrib.payments.models.Transaction',
# 'orchestra.contrib.payments.models.TransactionProcess',
'orchestra.contrib.issues.models.Ticket',
),
'collapsible': True,
}),
('Administration', {
'models': (
'djcelery.models.TaskState',
'orchestra.apps.orchestration.models.Route',
'orchestra.apps.orchestration.models.BackendLog',
'orchestra.apps.orchestration.models.Server',
'orchestra.apps.resources.models.Resource',
'orchestra.apps.resources.models.ResourceData',
'orchestra.apps.services.models.Service',
'orchestra.apps.plans.models.Plan',
'orchestra.apps.miscellaneous.models.MiscService',
'orchestra.contrib.orchestration.models.Route',
'orchestra.contrib.orchestration.models.BackendLog',
'orchestra.contrib.orchestration.models.Server',
'orchestra.contrib.resources.models.Resource',
'orchestra.contrib.resources.models.ResourceData',
'orchestra.contrib.services.models.Service',
'orchestra.contrib.plans.models.Plan',
'orchestra.contrib.miscellaneous.models.MiscService',
),
'collapsible': True,
}),

View File

@ -1,5 +1,6 @@
import copy
import re
from urllib.parse import parse_qsl
from django import forms
from django.conf.urls import patterns, url
@ -8,7 +9,6 @@ from django.contrib.admin.util import unquote
from django.contrib.auth import admin as auth
from django.http import HttpResponseRedirect
from django.utils.safestring import mark_safe
from django.utils.six.moves.urllib.parse import parse_qsl
from django.utils.translation import ugettext_lazy as _
from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin
@ -80,11 +80,11 @@ class AccountAdmin(ChangePasswordAdminMixin, auth.UserAdmin, ExtendedModelAdmin)
messages.warning(request, 'This account is disabled.')
context = {
'services': sorted(
[ model._meta for model in services.get() if model is not Account ],
[model._meta for model in services.get() if model is not Account],
key=lambda i: i.verbose_name_plural.lower()
),
'accounts': sorted(
[ model._meta for model in accounts.get() if model is not Account ],
[model._meta for model in accounts.get() if model is not Account],
key=lambda i: i.verbose_name_plural.lower()
)
}

View File

@ -5,8 +5,8 @@ from django.db.models.loading import get_model
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from orchestra.apps.orchestration.middlewares import OperationsMiddleware
from orchestra.apps.orchestration.models import BackendOperation as Operation
from orchestra.contrib.orchestration.middlewares import OperationsMiddleware
from orchestra.contrib.orchestration.models import BackendOperation as Operation
from orchestra.core import services, accounts
from orchestra.utils import send_email_template
@ -16,26 +16,27 @@ from . import settings
class Account(auth.AbstractBaseUser):
# Username max_length determined by LINUX system user lentgh: 32
username = models.CharField(_("username"), max_length=32, unique=True,
help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."),
validators=[validators.RegexValidator(r'^[\w.-]+$',
_("Enter a valid username."), 'invalid')])
help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."),
validators=[
validators.RegexValidator(r'^[\w.-]+$', _("Enter a valid username."), 'invalid')
])
main_systemuser = models.ForeignKey(settings.ACCOUNTS_SYSTEMUSER_MODEL, null=True,
related_name='accounts_main', editable=False)
related_name='accounts_main', editable=False)
short_name = models.CharField(_("short name"), max_length=64, blank=True)
full_name = models.CharField(_("full name"), max_length=256)
email = models.EmailField(_('email address'), help_text=_("Used for password recovery"))
type = models.CharField(_("type"), choices=settings.ACCOUNTS_TYPES,
max_length=32, default=settings.ACCOUNTS_DEFAULT_TYPE)
max_length=32, default=settings.ACCOUNTS_DEFAULT_TYPE)
language = models.CharField(_("language"), max_length=2,
choices=settings.ACCOUNTS_LANGUAGES,
default=settings.ACCOUNTS_DEFAULT_LANGUAGE)
choices=settings.ACCOUNTS_LANGUAGES,
default=settings.ACCOUNTS_DEFAULT_LANGUAGE)
comments = models.TextField(_("comments"), max_length=256, blank=True)
is_superuser = models.BooleanField(_("superuser status"), default=False,
help_text=_("Designates that this user has all permissions without "
"explicitly assigning them."))
help_text=_("Designates that this user has all permissions without "
"explicitly assigning them."))
is_active = models.BooleanField(_("active"), default=True,
help_text=_("Designates whether this account should be treated as active. "
"Unselect this instead of deleting accounts."))
help_text=_("Designates whether this account should be treated as active. "
"Unselect this instead of deleting accounts."))
date_joined = models.DateTimeField(_("date joined"), default=timezone.now)
objects = auth.UserManager()

View File

@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _
from orchestra.admin import ExtendedModelAdmin
from orchestra.admin.utils import admin_date, insertattr
from orchestra.apps.accounts.admin import AccountAdminMixin, AccountAdmin
from orchestra.contrib.accounts.admin import AccountAdminMixin, AccountAdmin
from orchestra.forms.widgets import paddingCheckboxSelectMultiple
from . import settings, actions

View File

@ -3,7 +3,7 @@ from rest_framework import viewsets
from rest_framework.decorators import detail_route
from orchestra.api import router
from orchestra.apps.accounts.api import AccountApiMixin
from orchestra.contrib.accounts.api import AccountApiMixin
from orchestra.utils.html import html_to_pdf
from .models import Bill

View File

@ -6,12 +6,10 @@ from orchestra.forms.widgets import ShowTextWidget
class SelectSourceForm(forms.ModelForm):
bill_link = forms.CharField(label=_("Number"), required=False,
widget=ShowTextWidget())
bill_link = forms.CharField(label=_("Number"), required=False, widget=ShowTextWidget())
account_link = forms.CharField(label=_("Account"), required=False)
display_total = forms.CharField(label=_("Total"), required=False)
display_type = forms.CharField(label=_("Type"), required=False,
widget=ShowTextWidget())
display_type = forms.CharField(label=_("Type"), required=False, widget=ShowTextWidget())
source = forms.ChoiceField(label=_("Source"), required=False)
class Meta:

View File

@ -8,8 +8,8 @@ from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from orchestra.apps.accounts.models import Account
from orchestra.apps.contacts.models import Contact
from orchestra.contrib.accounts.models import Account
from orchestra.contrib.contacts.models import Contact
from orchestra.core import accounts, validators
from orchestra.utils.html import html_to_pdf
@ -18,17 +18,17 @@ from . import settings
class BillContact(models.Model):
account = models.OneToOneField('accounts.Account', verbose_name=_("account"),
related_name='billcontact')
related_name='billcontact')
name = models.CharField(_("name"), max_length=256, blank=True,
help_text=_("Account full name will be used when left blank."))
help_text=_("Account full name will be used when left blank."))
address = models.TextField(_("address"))
city = models.CharField(_("city"), max_length=128,
default=settings.BILLS_CONTACT_DEFAULT_CITY)
default=settings.BILLS_CONTACT_DEFAULT_CITY)
zipcode = models.CharField(_("zip code"), max_length=10,
validators=[RegexValidator(r'^[0-9A-Z]{3,10}$', _("Enter a valid zipcode."))])
validators=[RegexValidator(r'^[0-9A-Z]{3,10}$', _("Enter a valid zipcode."))])
country = models.CharField(_("country"), max_length=20,
choices=settings.BILLS_CONTACT_COUNTRIES,
default=settings.BILLS_CONTACT_DEFAULT_COUNTRY)
choices=settings.BILLS_CONTACT_COUNTRIES,
default=settings.BILLS_CONTACT_DEFAULT_COUNTRY)
vat = models.CharField(_("VAT number"), max_length=64)
def __str__(self):
@ -81,7 +81,7 @@ class Bill(models.Model):
number = models.CharField(_("number"), max_length=16, unique=True, blank=True)
account = models.ForeignKey('accounts.Account', verbose_name=_("account"),
related_name='%(class)s')
related_name='%(class)s')
type = models.CharField(_("type"), max_length=16, choices=TYPES)
created_on = models.DateField(_("created on"), auto_now_add=True)
closed_on = models.DateField(_("closed on"), blank=True, null=True)
@ -279,7 +279,7 @@ class BillLine(models.Model):
# end = models.DateTimeField(null=True)
order = models.ForeignKey(settings.BILLS_ORDER_MODEL, null=True, blank=True,
help_text=_("Informative link back to the order"), on_delete=models.SET_NULL)
help_text=_("Informative link back to the order"), on_delete=models.SET_NULL)
order_billed_on = models.DateField(_("order billed"), null=True, blank=True)
order_billed_until = models.DateField(_("order billed until"), null=True, blank=True)
created_on = models.DateField(_("created"), auto_now_add=True)

View File

@ -1,8 +1,8 @@
from rest_framework import serializers
from orchestra.api import router
from orchestra.apps.accounts.models import Account
from orchestra.apps.accounts.serializers import AccountSerializerMixin
from orchestra.contrib.accounts.models import Account
from orchestra.contrib.accounts.serializers import AccountSerializerMixin
from .models import Bill, BillLine, BillContact

View File

@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
from orchestra.admin import AtLeastOneRequiredInlineFormSet, ExtendedModelAdmin
from orchestra.admin.actions import SendEmail
from orchestra.admin.utils import insertattr, change_url
from orchestra.apps.accounts.admin import AccountAdmin, AccountAdminMixin
from orchestra.contrib.accounts.admin import AccountAdmin, AccountAdminMixin
from orchestra.forms.widgets import paddingCheckboxSelectMultiple
from .filters import EmailUsageListFilter

View File

@ -1,7 +1,7 @@
from rest_framework import viewsets
from orchestra.api import router
from orchestra.apps.accounts.api import AccountApiMixin
from orchestra.contrib.accounts.api import AccountApiMixin
from .models import Contact
from .serializers import ContactSerializer

View File

@ -35,25 +35,27 @@ class Contact(models.Model):
objects = ContactQuerySet.as_manager()
account = models.ForeignKey('accounts.Account', verbose_name=_("Account"),
related_name='contacts', null=True)
related_name='contacts', null=True)
short_name = models.CharField(_("short name"), max_length=128)
full_name = models.CharField(_("full name"), max_length=256, blank=True)
email = models.EmailField()
email_usage = MultiSelectField(_("email usage"), max_length=256, blank=True,
choices=EMAIL_USAGES,
default=settings.CONTACTS_DEFAULT_EMAIL_USAGES)
choices=EMAIL_USAGES,
default=settings.CONTACTS_DEFAULT_EMAIL_USAGES)
phone = models.CharField(_("phone"), max_length=32, blank=True,
validators=[validate_phone])
validators=[validate_phone])
phone2 = models.CharField(_("alternative phone"), max_length=32, blank=True,
validators=[validate_phone])
validators=[validate_phone])
address = models.TextField(_("address"), blank=True)
city = models.CharField(_("city"), max_length=128, blank=True)
zipcode = models.CharField(_("zip code"), max_length=10, blank=True,
validators=[RegexValidator(r'^[0-9,A-Z]{3,10}$',
_("Enter a valid zipcode."), 'invalid')])
validators=[
RegexValidator(r'^[0-9,A-Z]{3,10}$',
_("Enter a valid zipcode."), 'invalid')
])
country = models.CharField(_("country"), max_length=20, blank=True,
choices=settings.CONTACTS_COUNTRIES,
default=settings.CONTACTS_DEFAULT_COUNTRY)
choices=settings.CONTACTS_COUNTRIES,
default=settings.CONTACTS_DEFAULT_COUNTRY)
def __str__(self):
return self.full_name or self.short_name

View File

@ -1,7 +1,7 @@
from rest_framework import serializers
from orchestra.api.serializers import MultiSelectField
from orchestra.apps.accounts.serializers import AccountSerializerMixin
from orchestra.contrib.accounts.serializers import AccountSerializerMixin
from .models import Contact

View File

@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin
from orchestra.admin.utils import change_url
from orchestra.apps.accounts.admin import SelectAccountAdminMixin
from orchestra.contrib.accounts.admin import SelectAccountAdminMixin
from .forms import DatabaseCreationForm, DatabaseUserChangeForm, DatabaseUserCreationForm
from .models import Database, DatabaseUser

View File

@ -1,7 +1,7 @@
from rest_framework import viewsets
from orchestra.api import router, SetPasswordApiMixin
from orchestra.apps.accounts.api import AccountApiMixin
from orchestra.contrib.accounts.api import AccountApiMixin
from .models import Database, DatabaseUser
from .serializers import DatabaseSerializer, DatabaseUserSerializer

View File

@ -2,8 +2,8 @@ import textwrap
from django.utils.translation import ugettext_lazy as _
from orchestra.apps.orchestration import ServiceController
from orchestra.apps.resources import ServiceMonitor
from orchestra.contrib.orchestration import ServiceController
from orchestra.contrib.resources import ServiceMonitor
from . import settings

View File

@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from orchestra.api.serializers import HyperlinkedModelSerializer
from orchestra.apps.accounts.serializers import AccountSerializerMixin
from orchestra.contrib.accounts.serializers import AccountSerializerMixin
from orchestra.core.validators import validate_password
from .models import Database, DatabaseUser

View File

@ -9,8 +9,8 @@ from django.core.urlresolvers import reverse
from selenium.webdriver.support.select import Select
from orchestra.admin.utils import change_url
from orchestra.apps.orchestration.models import Server, Route
from orchestra.utils.system import sshrun
from orchestra.contrib.orchestration.models import Server, Route
from orchestra.utils.sys import sshrun
from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii, save_response_on_error,
snapshot_on_error)
@ -21,7 +21,7 @@ from ...models import Database, DatabaseUser
class DatabaseTestMixin(object):
MASTER_SERVER = os.environ.get('ORCHESTRA_SECOND_SERVER', 'localhost')
DEPENDENCIES = (
'orchestra.apps.orchestration',
'orchestra.contrib.orchestration',
'orcgestra.apps.databases',
)

View File

@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _
from orchestra.admin import ExtendedModelAdmin
from orchestra.admin.utils import admin_link, change_url
from orchestra.apps.accounts.admin import AccountAdminMixin
from orchestra.contrib.accounts.admin import AccountAdminMixin
from orchestra.utils import apps
from .actions import view_zone
@ -86,7 +86,7 @@ class DomainAdmin(AccountAdminMixin, ExtendedModelAdmin):
display_is_top.admin_order_field = 'top'
def display_websites(self, domain):
if apps.isinstalled('orchestra.apps.websites'):
if apps.isinstalled('orchestra.contrib.websites'):
webs = domain.websites.all()
if webs:
links = []
@ -111,7 +111,7 @@ class DomainAdmin(AccountAdminMixin, ExtendedModelAdmin):
'structured_name': 'CONCAT({table}.name, domains_domain.name)'.format(table=table)
},
).order_by('structured_name')
if apps.isinstalled('orchestra.apps.websites'):
if apps.isinstalled('orchestra.contrib.websites'):
qs = qs.prefetch_related('websites')
return qs

View File

@ -3,7 +3,7 @@ from rest_framework.decorators import link
from rest_framework.response import Response
from orchestra.api import router
from orchestra.apps.accounts.api import AccountApiMixin
from orchestra.contrib.accounts.api import AccountApiMixin
from . import settings
from .models import Domain

View File

@ -3,8 +3,8 @@ import textwrap
from django.utils.translation import ugettext_lazy as _
from orchestra.apps.orchestration import ServiceController
from orchestra.apps.orchestration.models import BackendOperation as Operation
from orchestra.contrib.orchestration import ServiceController
from orchestra.contrib.orchestration.models import BackendOperation as Operation
from . import settings
@ -79,7 +79,7 @@ class Bind9MasterDomainBackend(ServiceController):
def get_servers(self, domain, backend):
""" Get related server IPs from registered backend routes """
from orchestra.apps.orchestration.manager import router
from orchestra.contrib.orchestration.manager import router
operation = Operation.create(backend, domain, Operation.SAVE)
servers = []
for server in router.get_servers(operation):

View File

@ -9,7 +9,7 @@ from .models import Domain
class BatchDomainCreationAdminForm(forms.ModelForm):
name = forms.CharField(label=_("Names"), widget=forms.Textarea(attrs={'rows': 5, 'cols': 50}),
help_text=_("Domain per line. All domains will share the same attributes."))
help_text=_("Domain per line. All domains will share the same attributes."))
def clean_name(self):
self.extra_names = []

View File

@ -11,17 +11,17 @@ from . import settings, validators, utils
class Domain(models.Model):
name = models.CharField(_("name"), max_length=256, unique=True,
help_text=_("Domain or subdomain name."),
validators=[
validators.validate_domain_name,
validators.validate_allowed_domain
])
help_text=_("Domain or subdomain name."),
validators=[
validators.validate_domain_name,
validators.validate_allowed_domain
])
account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), blank=True,
related_name='domains', help_text=_("Automatically selected for subdomains."))
related_name='domains', help_text=_("Automatically selected for subdomains."))
top = models.ForeignKey('domains.Domain', null=True, related_name='subdomain_set',
editable=False)
editable=False)
serial = models.IntegerField(_("serial"), default=utils.generate_zone_serial,
help_text=_("Serial number"))
help_text=_("Serial number"))
def __str__(self):
return self.name
@ -223,8 +223,8 @@ class Record(models.Model):
domain = models.ForeignKey(Domain, verbose_name=_("domain"), related_name='records')
ttl = models.CharField(_("TTL"), max_length=8, blank=True,
help_text=_("Record TTL, defaults to %s") % settings.DOMAINS_DEFAULT_TTL,
validators=[validators.validate_zone_interval])
help_text=_("Record TTL, defaults to %s") % settings.DOMAINS_DEFAULT_TTL,
validators=[validators.validate_zone_interval])
type = models.CharField(_("type"), max_length=32, choices=TYPE_CHOICES)
value = models.CharField(_("value"), max_length=256)

View File

@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from orchestra.api.serializers import HyperlinkedModelSerializer
from orchestra.apps.accounts.serializers import AccountSerializerMixin
from orchestra.contrib.accounts.serializers import AccountSerializerMixin
from .helpers import domain_for_validation
from .models import Domain, Record

View File

@ -88,4 +88,5 @@ DOMAINS_FORBIDDEN = getattr(settings, 'DOMAINS_FORBIDDEN',
# unzip -p /tmp/top-1m.csv.zip | head -n 5000 | sed "s/^.*,//" > forbidden_domains.list
# '%(site_dir)s/forbidden_domains.list')
'')
''
)

View File

@ -7,9 +7,9 @@ from django.conf import settings as djsettings
from django.core.urlresolvers import reverse
from selenium.webdriver.support.select import Select
from orchestra.apps.orchestration.models import Server, Route
from orchestra.contrib.orchestration.models import Server, Route
from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error
from orchestra.utils.system import run
from orchestra.utils.sys import run
from ... import settings, utils, backends
from ...models import Domain, Record
@ -305,7 +305,7 @@ class RESTDomainMixin(DomainTestMixin):
class Bind9BackendMixin(object):
DEPENDENCIES = (
'orchestra.apps.orchestration',
'orchestra.contrib.orchestration',
)
def add_route(self):

View File

@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _
from orchestra.core.validators import validate_hostname
from orchestra.utils import paths
from orchestra.utils.system import run
from orchestra.utils.sys import run
from . import settings

View File

@ -11,7 +11,7 @@ from markdown import markdown
from orchestra.admin import ChangeListDefaultFilter, ExtendedModelAdmin#, ChangeViewActions
from orchestra.admin.utils import admin_link, admin_colored, wrap_admin_view, admin_date
from orchestra.apps.contacts.models import Contact
from orchestra.contrib.contacts.models import Contact
from .actions import (reject_tickets, resolve_tickets, take_tickets, close_tickets,
mark_as_unread, mark_as_read, set_default_queue)

View File

@ -108,4 +108,4 @@ class TicketForm(forms.ModelForm):
class ChangeReasonForm(forms.Form):
reason = forms.CharField(widget=forms.Textarea(attrs={'cols': '100', 'rows': '10'}),
required=False)
required=False)

View File

@ -2,8 +2,8 @@ from django.conf import settings as djsettings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from orchestra.apps.contacts import settings as contacts_settings
from orchestra.apps.contacts.models import Contact
from orchestra.contrib.contacts import settings as contacts_settings
from orchestra.contrib.contacts.models import Contact
from orchestra.core.translations import ModelTranslation
from orchestra.models.fields import MultiSelectField
from orchestra.utils import send_email_template
@ -16,9 +16,9 @@ class Queue(models.Model):
verbose_name = models.CharField(_("verbose_name"), max_length=128, blank=True)
default = models.BooleanField(_("default"), default=False)
notify = MultiSelectField(_("notify"), max_length=256, blank=True,
choices=Contact.EMAIL_USAGES,
default=contacts_settings.CONTACTS_DEFAULT_EMAIL_USAGES,
help_text=_("Contacts to notify by email"))
choices=Contact.EMAIL_USAGES,
default=contacts_settings.CONTACTS_DEFAULT_EMAIL_USAGES,
help_text=_("Contacts to notify by email"))
def __str__(self):
return self.verbose_name or self.name
@ -59,15 +59,15 @@ class Ticket(models.Model):
)
creator = models.ForeignKey(djsettings.AUTH_USER_MODEL, verbose_name=_("created by"),
related_name='tickets_created', null=True)
related_name='tickets_created', null=True)
creator_name = models.CharField(_("creator name"), max_length=256, blank=True)
owner = models.ForeignKey(djsettings.AUTH_USER_MODEL, null=True, blank=True,
related_name='tickets_owned', verbose_name=_("assigned to"))
related_name='tickets_owned', verbose_name=_("assigned to"))
queue = models.ForeignKey(Queue, related_name='tickets', null=True, blank=True)
subject = models.CharField(_("subject"), max_length=256)
description = models.TextField(_("description"))
priority = models.CharField(_("priority"), max_length=32, choices=PRIORITIES,
default=MEDIUM)
default=MEDIUM)
state = models.CharField(_("state"), max_length=32, choices=STATES, default=NEW)
created_at = models.DateTimeField(_("created"), auto_now_add=True)
updated_at = models.DateTimeField(_("modified"), auto_now=True)
@ -154,9 +154,9 @@ class Ticket(models.Model):
class Message(models.Model):
ticket = models.ForeignKey('issues.Ticket', verbose_name=_("ticket"),
related_name='messages')
related_name='messages')
author = models.ForeignKey(djsettings.AUTH_USER_MODEL, verbose_name=_("author"),
related_name='ticket_messages')
related_name='ticket_messages')
author_name = models.CharField(_("author name"), max_length=256, blank=True)
content = models.TextField(_("content"))
created_on = models.DateTimeField(_("created on"), auto_now_add=True)
@ -183,10 +183,9 @@ class Message(models.Model):
class TicketTracker(models.Model):
""" Keeps track of user read tickets """
ticket = models.ForeignKey(Ticket, verbose_name=_("ticket"),
related_name='trackers')
ticket = models.ForeignKey(Ticket, verbose_name=_("ticket"), related_name='trackers')
user = models.ForeignKey(djsettings.AUTH_USER_MODEL, verbose_name=_("user"),
related_name='ticket_trackers')
related_name='ticket_trackers')
class Meta:
unique_together = (

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin
from orchestra.admin.utils import admin_link
from orchestra.apps.accounts.admin import SelectAccountAdminMixin
from orchestra.contrib.accounts.admin import SelectAccountAdminMixin
from .forms import ListCreationForm, ListChangeForm
from .models import List

View File

@ -1,7 +1,7 @@
from rest_framework import viewsets
from orchestra.api import router, SetPasswordApiMixin
from orchestra.apps.accounts.api import AccountApiMixin
from orchestra.contrib.accounts.api import AccountApiMixin
from .models import List
from .serializers import ListSerializer

View File

@ -2,8 +2,8 @@ import textwrap
from django.utils.translation import ugettext_lazy as _
from orchestra.apps.orchestration import ServiceController
from orchestra.apps.resources import ServiceMonitor
from orchestra.contrib.orchestration import ServiceController
from orchestra.contrib.resources import ServiceMonitor
from . import settings
from .models import List

View File

@ -17,10 +17,10 @@ class CleanAddressMixin(object):
class ListCreationForm(CleanAddressMixin, forms.ModelForm):
password1 = forms.CharField(label=_("Password"), validators=[validate_password],
widget=forms.PasswordInput)
widget=forms.PasswordInput)
password2 = forms.CharField(label=_("Password confirmation"),
widget=forms.PasswordInput,
help_text=_("Enter the same password as above, for verification."))
widget=forms.PasswordInput,
help_text=_("Enter the same password as above, for verification."))
def clean_password2(self):
password1 = self.cleaned_data.get("password1")
@ -33,7 +33,7 @@ class ListCreationForm(CleanAddressMixin, forms.ModelForm):
class ListChangeForm(CleanAddressMixin, forms.ModelForm):
password = forms.CharField(label=_("Password"),
widget=ReadOnlyWidget('<strong>Unknown password</strong>'),
help_text=_("List passwords are not stored, so there is no way to see this "
"list's password, but you can change the password using "
"<a href=\"password/\">this form</a>."))
widget=ReadOnlyWidget('<strong>Unknown password</strong>'),
help_text=_("List passwords are not stored, so there is no way to see this "
"list's password, but you can change the password using "
"<a href=\"password/\">this form</a>."))

View File

@ -12,15 +12,15 @@ from . import settings
class List(models.Model):
name = models.CharField(_("name"), max_length=128, unique=True, validators=[validate_name],
help_text=_("Default list address &lt;name&gt;@%s") % settings.LISTS_DEFAULT_DOMAIN)
help_text=_("Default list address &lt;name&gt;@%s") % settings.LISTS_DEFAULT_DOMAIN)
address_name = models.CharField(_("address name"), max_length=128,
validators=[validate_name], blank=True)
validators=[validate_name], blank=True)
address_domain = models.ForeignKey(settings.LISTS_DOMAIN_MODEL,
verbose_name=_("address domain"), blank=True, null=True)
verbose_name=_("address domain"), blank=True, null=True)
admin_email = models.EmailField(_("admin email"),
help_text=_("Administration email address"))
help_text=_("Administration email address"))
account = models.ForeignKey('accounts.Account', verbose_name=_("Account"),
related_name='lists')
related_name='lists')
# TODO also admin
# TODO is_active = models.BooleanField(_("active"), default=True,
# help_text=_("Designates whether this account should be treated as active. "

View File

@ -4,7 +4,7 @@ from django.shortcuts import get_object_or_404
from rest_framework import serializers
from orchestra.api.serializers import HyperlinkedModelSerializer
from orchestra.apps.accounts.serializers import AccountSerializerMixin
from orchestra.contrib.accounts.serializers import AccountSerializerMixin
from orchestra.core.validators import validate_password
from .models import List

Some files were not shown because too many files have changed in this diff Show More