1
# Copyright 2014 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Model for filtering a selection of boot resources."""
6
from __future__ import (
16
'BootSourceSelection',
20
from django.db.models import (
25
import djorm_pgarray.fields
26
from maasserver import DefaultMeta
27
from maasserver.models.cleansave import CleanSave
28
from maasserver.models.timestampedmodel import TimestampedModel
31
class BootSourceSelectionManager(Manager):
32
"""Manager for `BootSourceSelection` class."""
35
class BootSourceSelection(CleanSave, TimestampedModel):
36
"""A set of selections for a single `BootSource`."""
38
class Meta(DefaultMeta):
39
"""Needed for South to recognize this model."""
41
objects = BootSourceSelectionManager()
43
boot_source = ForeignKey('maasserver.BootSource', blank=False)
46
max_length=20, blank=True, default='',
47
help_text="The Ubuntu release for which to import resources.")
49
arches = djorm_pgarray.fields.ArrayField(dbtype="text")
51
subarches = djorm_pgarray.fields.ArrayField(dbtype="text")
53
labels = djorm_pgarray.fields.ArrayField(dbtype="text")
56
"""Return the current `BootSourceSelection` as a dict."""
58
"release": self.release,
59
"arches": self.arches,
60
"subarches": self.subarches,
61
"labels": self.labels,