Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions openwisp_controller/config/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,22 @@ def register_menu_groups(self):
register_menu_group(
position=30,
config={
'label': 'Configurations',
'label': _('Configurations'),
'items': {
1: {
'label': 'Templates',
'label': _('Templates'),
'model': get_model_name('config', 'Template'),
'name': 'changelist',
'icon': 'ow-template',
},
2: {
'label': 'VPN Servers',
'label': _('VPN Servers'),
'model': get_model_name('config', 'Vpn'),
'name': 'changelist',
'icon': 'ow-vpn',
},
4: {
'label': 'Device Groups',
'label': _('Device Groups'),
'model': get_model_name('config', 'DeviceGroup'),
'name': 'changelist',
'icon': 'ow-device-group',
Expand Down
6 changes: 5 additions & 1 deletion openwisp_controller/config/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class BaseModel(TimeStampedEditableModel):
Shared logic
"""

name = models.CharField(max_length=64, db_index=True)
name = models.CharField(
verbose_name=_('name'),
max_length=64,
db_index=True
)

class Meta:
abstract = True
Expand Down
14 changes: 12 additions & 2 deletions openwisp_controller/config/base/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class AbstractConfig(BaseConfig):
"""

device = models.OneToOneField(
get_model_name('config', 'Device'), on_delete=models.CASCADE
get_model_name('config', 'Device'),
on_delete=models.CASCADE,
verbose_name=_('device'),
)
templates = SortedManyToManyField(
get_model_name('config', 'Template'),
Expand All @@ -68,7 +70,14 @@ class AbstractConfig(BaseConfig):
blank=True,
)

STATUS = Choices('modified', 'applied', 'error', 'deactivating', 'deactivated')
STATUS = Choices(
('modified', _('modified')),
('applied', _('applied')),
('error', _('error')),
('deactivating', _('deactivating')),
('deactivated'), _('deactivated')
)

status = StatusField(
_('configuration status'),
help_text=_(
Expand Down Expand Up @@ -97,6 +106,7 @@ class AbstractConfig(BaseConfig):
),
load_kwargs={'object_pairs_hook': collections.OrderedDict},
dump_kwargs={'indent': 4},
verbose_name=_('context'),
)

_CHECKSUM_CACHE_TIMEOUT = 60 * 60 * 24 * 30 # 10 days
Expand Down
10 changes: 8 additions & 2 deletions openwisp_controller/config/base/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ class AbstractDevice(OrgMixin, BaseModel):
_changed_checked_fields = ['name', 'group_id', 'management_ip', 'organization_id']

name = models.CharField(
verbose_name=_('name'),
max_length=64,
unique=False,
validators=[device_name_validator],
db_index=True,
help_text=_('must be either a valid hostname or mac address'),
)
mac_address = models.CharField(
verbose_name=_('mac address'),
max_length=17,
db_index=True,
unique=False,
Expand All @@ -50,8 +52,10 @@ class AbstractDevice(OrgMixin, BaseModel):
default=None,
db_index=True,
help_text=_('unique device key'),
verbose_name=_('key'),
)
model = models.CharField(
verbose_name=_('model'),
max_length=64,
blank=True,
db_index=True,
Expand All @@ -71,7 +75,7 @@ class AbstractDevice(OrgMixin, BaseModel):
max_length=128,
help_text=_('system on chip or CPU info'),
)
notes = models.TextField(blank=True, help_text=_('internal notes'))
notes = models.TextField(verbose_name=_('notes'), blank=True, help_text=_('internal notes'))
group = models.ForeignKey(
get_model_name('config', 'DeviceGroup'),
verbose_name=_('group'),
Expand All @@ -82,6 +86,7 @@ class AbstractDevice(OrgMixin, BaseModel):
# these fields are filled automatically
# with data received from devices
last_ip = models.GenericIPAddressField(
verbose_name=_('last IP address'),
blank=True,
null=True,
db_index=True,
Expand All @@ -91,6 +96,7 @@ class AbstractDevice(OrgMixin, BaseModel):
),
)
management_ip = models.GenericIPAddressField(
verbose_name=_('management IP address'),
blank=True,
null=True,
db_index=True,
Expand All @@ -105,7 +111,7 @@ class AbstractDevice(OrgMixin, BaseModel):
# This is an internal field which is used to track if
# the device has been deactivated. This field should not be changed
# directly, use the deactivate() method instead.
_is_deactivated = models.BooleanField(default=False)
_is_deactivated = models.BooleanField(verbose_name=_('is deactivated'), default=False)

class Meta:
unique_together = (
Expand Down
13 changes: 11 additions & 2 deletions openwisp_controller/config/base/device_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@


class AbstractDeviceGroup(OrgMixin, TimeStampedEditableModel):
name = models.CharField(max_length=60, null=False, blank=False)
description = models.TextField(blank=True, help_text=_('internal notes'))
name = models.CharField(
max_length=60,
null=False,
blank=False,
verbose_name=_('Name')
)
description = models.TextField(
blank=True,
help_text=_('internal notes'),
verbose_name=_('Description')
)
templates = SortedManyToManyField(
get_model_name('config', 'Template'),
related_name='device_group_relations',
Expand Down
1 change: 1 addition & 0 deletions openwisp_controller/config/base/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class AbstractTaggedTemplate(GenericUUIDTaggedItemBase, TaggedItemBase):
get_model_name('config', 'TemplateTag'),
related_name='%(app_label)s_%(class)s_items',
on_delete=models.CASCADE,
verbose_name=_('Tag'),
)

class Meta:
Expand Down
13 changes: 7 additions & 6 deletions openwisp_controller/config/base/vpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ class AbstractVpn(ShareableOrgMixinUniqueName, BaseConfig):
null=True,
on_delete=models.CASCADE,
)
key = KeyField(db_index=True)
key = KeyField(db_index=True, verbose_name=_('Private Key'))
backend = models.CharField(
_('VPN backend'),
choices=app_settings.VPN_BACKENDS,
max_length=128,
help_text=_('Select VPN configuration backend'),
)
notes = models.TextField(blank=True)
notes = models.TextField(verbose_name=_('Notes'), blank=True)
# optional, needed for VPNs which do not support automatic IP allocation
subnet = models.ForeignKey(
get_model_name('openwisp_ipam', 'Subnet'),
Expand Down Expand Up @@ -128,11 +128,12 @@ class AbstractVpn(ShareableOrgMixinUniqueName, BaseConfig):
'-----END DH PARAMETERS-----\n'
)
# needed for wireguard
public_key = models.CharField(blank=True, max_length=44)
private_key = models.CharField(blank=True, max_length=44)
public_key = models.CharField(verbose_name=_('Public key'),blank=True, max_length=44)
private_key = models.CharField(verbose_name=_('Private key'), blank=True, max_length=44)
# needed for zerotier
node_id = models.CharField(blank=True, max_length=10)
network_id = models.CharField(blank=True, max_length=16)
node_id = models.CharField(verbose_name=_('Node ID'), blank=True, max_length=10)
network_id = models.CharField( verbose_name=_('Network ID'), blank=True, max_length=16)


__vpn__ = True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{% endblocktranslate %}
</p>
<span>
<button class="danger-btn" id="warning-ack">{% translate 'I understand the risks, delete the device' %}</button>
<button class="danger-btn" id="warning-ack">{% translate 'I understand the risks, delete the device' context 'singular' %}</button>
<button class="button cancel-link">{% translate 'No, take me back' %}</button>
</span>
</li>
Expand Down
6 changes: 3 additions & 3 deletions openwisp_controller/geo/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ def register_menu_groups(self):
register_menu_group(
position=50,
config={
'label': 'Geographic Info',
'label': _('Geographic Info'),
'items': {
1: {
'label': 'Locations',
'label': _('Locations'),
'model': get_model_name('geo', 'Location'),
'name': 'changelist',
'icon': 'ow-location',
},
2: {
'label': 'Floorplans',
'label': _('Floorplans'),
'model': get_model_name('geo', 'FloorPlan'),
'name': 'changelist',
'icon': 'ow-floor',
Expand Down
Loading