Added ID to serializers
This commit is contained in:
parent
f090ecc3a9
commit
83831edf0b
|
@ -70,9 +70,8 @@ If you are planing to do some development or perhaps just checking out this proj
|
|||
sshfs orchestra@<container-ip>: ~<user>/orchestra
|
||||
```
|
||||
|
||||
5. To upgrade to current master just
|
||||
5. To upgrade to current master just re-run the deploy script
|
||||
```bash
|
||||
cd ~orchestra/django-orchestra/
|
||||
sudo ~orchestra/django-orchestra/scripts/container/deploy.sh
|
||||
```
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ INSTALLED_APPS = (
|
|||
'orchestra.contrib.miscellaneous',
|
||||
'orchestra.contrib.bills',
|
||||
'orchestra.contrib.payments',
|
||||
'orchestra.contrib.tasks',
|
||||
|
||||
# Third-party apps
|
||||
'django_extensions',
|
||||
|
|
|
@ -7,7 +7,7 @@ class AccountSerializer(serializers.HyperlinkedModelSerializer):
|
|||
class Meta:
|
||||
model = Account
|
||||
fields = (
|
||||
'url', 'username', 'type', 'language', 'short_name', 'full_name', 'date_joined',
|
||||
'url', 'id', 'username', 'type', 'language', 'short_name', 'full_name', 'date_joined',
|
||||
'is_active'
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class BillSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSeriali
|
|||
class Meta:
|
||||
model = Bill
|
||||
fields = (
|
||||
'url', 'number', 'type', 'total', 'is_sent', 'created_on', 'due_on',
|
||||
'url', 'id', 'number', 'type', 'total', 'is_sent', 'created_on', 'due_on',
|
||||
'comments',
|
||||
# 'lines'
|
||||
)
|
||||
|
|
|
@ -12,6 +12,6 @@ class ContactSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSeri
|
|||
class Meta:
|
||||
model = Contact
|
||||
fields = (
|
||||
'url', 'short_name', 'full_name', 'email', 'email_usage', 'phone',
|
||||
'url', 'id', 'short_name', 'full_name', 'email', 'email_usage', 'phone',
|
||||
'phone2', 'address', 'city', 'zipcode', 'country'
|
||||
)
|
||||
|
|
|
@ -12,7 +12,7 @@ from .models import Database, DatabaseUser
|
|||
class RelatedDatabaseUserSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = DatabaseUser
|
||||
fields = ('url', 'username')
|
||||
fields = ('url', 'id', 'username')
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -24,7 +24,7 @@ class DatabaseSerializer(AccountSerializerMixin, HyperlinkedModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = Database
|
||||
fields = ('url', 'name', 'type', 'users')
|
||||
fields = ('url', 'id', 'name', 'type', 'users')
|
||||
postonly_fields = ('name', 'type')
|
||||
|
||||
def validate(self, attrs):
|
||||
|
@ -38,7 +38,7 @@ class DatabaseSerializer(AccountSerializerMixin, HyperlinkedModelSerializer):
|
|||
class RelatedDatabaseSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Database
|
||||
fields = ('url', 'name',)
|
||||
fields = ('url', 'id', 'name',)
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -50,7 +50,7 @@ class DatabaseUserSerializer(AccountSerializerMixin, SetPasswordHyperlinkedSeria
|
|||
|
||||
class Meta:
|
||||
model = DatabaseUser
|
||||
fields = ('url', 'username', 'password', 'type', 'databases')
|
||||
fields = ('url', 'id', 'username', 'password', 'type', 'databases')
|
||||
postonly_fields = ('username', 'type', 'password')
|
||||
|
||||
def validate(self, attrs):
|
||||
|
|
|
@ -25,7 +25,7 @@ class DomainSerializer(AccountSerializerMixin, HyperlinkedModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = Domain
|
||||
fields = ('url', 'name', 'records')
|
||||
fields = ('url', 'id', 'name', 'records')
|
||||
postonly_fields = ('name',)
|
||||
|
||||
def clean_name(self, attrs, source):
|
||||
|
|
|
@ -6,14 +6,14 @@ from .models import Ticket, Message, Queue
|
|||
class QueueSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Queue
|
||||
fields = ('url', 'name', 'default', 'notify')
|
||||
fields = ('url', 'id', 'name', 'default', 'notify')
|
||||
read_only_fields = ('name', 'default', 'notify')
|
||||
|
||||
|
||||
class MessageSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Message
|
||||
fields = ('id', 'author', 'author_name', 'content', 'created_on')
|
||||
fields = ('url', 'id', 'author', 'author_name', 'content', 'created_on')
|
||||
read_only_fields = ('author', 'author_name', 'created_on')
|
||||
|
||||
def get_identity(self, data):
|
||||
|
|
|
@ -14,7 +14,7 @@ from .models import List
|
|||
class RelatedDomainSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = List.address_domain.field.rel.to
|
||||
fields = ('url', 'name')
|
||||
fields = ('url', 'id', 'name')
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -36,7 +36,7 @@ class ListSerializer(AccountSerializerMixin, SetPasswordHyperlinkedSerializer):
|
|||
|
||||
class Meta:
|
||||
model = List
|
||||
fields = ('url', 'name', 'password', 'address_name', 'address_domain', 'admin_email')
|
||||
fields = ('url', 'id', 'name', 'password', 'address_name', 'address_domain', 'admin_email')
|
||||
postonly_fields = ('name', 'password')
|
||||
|
||||
def validate_address_domain(self, attrs, source):
|
||||
|
|
|
@ -12,7 +12,7 @@ from .models import Mailbox, Address
|
|||
class RelatedDomainSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Address.domain.field.rel.to
|
||||
fields = ('url', 'name')
|
||||
fields = ('url', 'id', 'name')
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -24,7 +24,7 @@ class RelatedAddressSerializer(AccountSerializerMixin, serializers.HyperlinkedMo
|
|||
|
||||
class Meta:
|
||||
model = Address
|
||||
fields = ('url', 'name', 'domain', 'forward')
|
||||
fields = ('url', 'id', 'name', 'domain', 'forward')
|
||||
#
|
||||
# def from_native(self, data, files=None):
|
||||
# queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -37,7 +37,7 @@ class MailboxSerializer(AccountSerializerMixin, SetPasswordHyperlinkedSerializer
|
|||
class Meta:
|
||||
model = Mailbox
|
||||
fields = (
|
||||
'url', 'name', 'password', 'filtering', 'custom_filtering', 'addresses', 'is_active'
|
||||
'url', 'id', 'name', 'password', 'filtering', 'custom_filtering', 'addresses', 'is_active'
|
||||
)
|
||||
postonly_fields = ('name', 'password')
|
||||
|
||||
|
@ -45,7 +45,7 @@ class MailboxSerializer(AccountSerializerMixin, SetPasswordHyperlinkedSerializer
|
|||
class RelatedMailboxSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Mailbox
|
||||
fields = ('url', 'name')
|
||||
fields = ('url', 'id', 'name')
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -58,7 +58,7 @@ class AddressSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSeri
|
|||
|
||||
class Meta:
|
||||
model = Address
|
||||
fields = ('url', 'name', 'domain', 'mailboxes', 'forward')
|
||||
fields = ('url', 'id', 'name', 'domain', 'mailboxes', 'forward')
|
||||
|
||||
def validate(self, attrs):
|
||||
attrs = super(AddressSerializer, self).validate(attrs)
|
||||
|
|
|
@ -9,6 +9,6 @@ class OrderSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerial
|
|||
class Meta:
|
||||
model = Order
|
||||
fields = (
|
||||
'url', 'registered_on', 'cancelled_on', 'billed_on', 'billed_until',
|
||||
'url', 'id', 'registered_on', 'cancelled_on', 'billed_on', 'billed_until',
|
||||
'description'
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ from .models import PaymentSource, Transaction
|
|||
class PaymentSourceSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = PaymentSource
|
||||
fields = ('url', 'method', 'data', 'is_active')
|
||||
fields = ('url', 'id', 'method', 'data', 'is_active')
|
||||
|
||||
def validate_data(self, attrs, source):
|
||||
plugin = PaymentMethod.get(attrs['method'])
|
||||
|
|
|
@ -25,5 +25,5 @@ class SaaSSerializer(AccountSerializerMixin, SetPasswordHyperlinkedSerializer):
|
|||
|
||||
class Meta:
|
||||
model = SaaS
|
||||
fields = ('url', 'name', 'service', 'is_active', 'data', 'password')
|
||||
fields = ('url', 'id', 'name', 'service', 'is_active', 'data', 'password')
|
||||
postonly_fields = ('name', 'service', 'password')
|
||||
|
|
|
@ -13,7 +13,7 @@ from .validators import validate_home
|
|||
class GroupSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = SystemUser
|
||||
fields = ('url', 'username',)
|
||||
fields = ('url', 'id', 'username',)
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -26,7 +26,7 @@ class SystemUserSerializer(AccountSerializerMixin, SetPasswordHyperlinkedSeriali
|
|||
class Meta:
|
||||
model = SystemUser
|
||||
fields = (
|
||||
'url', 'username', 'password', 'home', 'directory', 'shell', 'groups', 'is_active',
|
||||
'url', 'id', 'username', 'password', 'home', 'directory', 'shell', 'groups', 'is_active',
|
||||
)
|
||||
postonly_fields = ('username', 'password')
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class WebAppSerializer(AccountSerializerMixin, HyperlinkedModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = WebApp
|
||||
fields = ('url', 'name', 'type', 'options')
|
||||
fields = ('url', 'id', 'name', 'type', 'options')
|
||||
postonly_fields = ('name', 'type')
|
||||
|
||||
def create(self, validated_data):
|
||||
|
|
|
@ -12,7 +12,7 @@ from .validators import validate_domain_protocol
|
|||
class RelatedDomainSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Website.domains.field.rel.to
|
||||
fields = ('url', 'name')
|
||||
fields = ('url', 'id', 'name')
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -22,7 +22,7 @@ class RelatedDomainSerializer(AccountSerializerMixin, serializers.HyperlinkedMod
|
|||
class RelatedWebAppSerializer(AccountSerializerMixin, serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = Content.webapp.field.rel.to
|
||||
fields = ('url', 'name', 'type')
|
||||
fields = ('url', 'id', 'name', 'type')
|
||||
|
||||
def from_native(self, data, files=None):
|
||||
queryset = self.opts.model.objects.filter(account=self.account)
|
||||
|
@ -60,7 +60,7 @@ class WebsiteSerializer(AccountSerializerMixin, HyperlinkedModelSerializer):
|
|||
|
||||
class Meta:
|
||||
model = Website
|
||||
fields = ('url', 'name', 'protocol', 'domains', 'is_active', 'contents', 'directives')
|
||||
fields = ('url', 'id', 'name', 'protocol', 'domains', 'is_active', 'contents', 'directives')
|
||||
postonly_fileds = ('name',)
|
||||
|
||||
def full_clean(self, instance):
|
||||
|
|
|
@ -68,7 +68,7 @@ class Command(BaseCommand):
|
|||
|
||||
manage_path = os.path.join(get_site_dir(), 'manage.py')
|
||||
run("python %s collectstatic --noinput" % manage_path)
|
||||
run("python %s syncdb --noinput" % manage_path)
|
||||
run("python %s migrate --noinput accounts" % manage_path)
|
||||
run("python %s migrate --noinput" % manage_path)
|
||||
if options.get('restart'):
|
||||
run("python %s restartservices" % manage_path)
|
||||
|
|
|
@ -44,7 +44,12 @@ def running_syncdb():
|
|||
|
||||
|
||||
def database_ready():
|
||||
return not running_syncdb() and 'setuppostgres' not in sys.argv and 'test' not in sys.argv and 'celerybeat' not in sys.argv
|
||||
return (not running_syncdb() and
|
||||
'setuppostgres' not in sys.argv and
|
||||
'test' not in sys.argv and
|
||||
'celerybeat' not in sys.argv and
|
||||
len(sys.argv) <= 1 and
|
||||
'--help' in sys.argv)
|
||||
|
||||
|
||||
def dict_setting_to_choices(choices):
|
||||
|
|
|
@ -55,6 +55,8 @@ if [[ ! $CURRENT_VERSION ]]; then
|
|||
else
|
||||
# Upgrade and relay on postguprade for finishing up the installation
|
||||
surun "export GIT_DIR=~/django-orchestra/.git && git checkout master && git pull origin"
|
||||
# TODO pass testing to postupgrade instead of running his here
|
||||
sudo orchestra-admin install_requirements --testing
|
||||
$PYTHON_BIN $MANAGE migrate postupgradeorchestra --from $CURRENT_VERSION
|
||||
exit
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue