mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-07 16:18:16 -06:00
Merge branch 'develop' into 17117-safari
This commit is contained in:
commit
ae0b372128
@ -195,7 +195,7 @@ class LocationFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelF
|
|||||||
model = Location
|
model = Location
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag'),
|
FieldSet('q', 'filter_id', 'tag'),
|
||||||
FieldSet('region_id', 'site_group_id', 'site_id', 'parent_id', 'status', name=_('Attributes')),
|
FieldSet('region_id', 'site_group_id', 'site_id', 'parent_id', 'status', 'facility', name=_('Attributes')),
|
||||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||||
)
|
)
|
||||||
@ -232,6 +232,10 @@ class LocationFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelF
|
|||||||
choices=LocationStatusChoices,
|
choices=LocationStatusChoices,
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
facility = forms.CharField(
|
||||||
|
label=_('Facility'),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,6 +99,11 @@ class SiteTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
|||||||
url_params={'site_id': 'pk'},
|
url_params={'site_id': 'pk'},
|
||||||
verbose_name=_('ASN Count')
|
verbose_name=_('ASN Count')
|
||||||
)
|
)
|
||||||
|
device_count = columns.LinkedCountColumn(
|
||||||
|
viewname='dcim:device_list',
|
||||||
|
url_params={'site_id': 'pk'},
|
||||||
|
verbose_name=_('Devices')
|
||||||
|
)
|
||||||
comments = columns.MarkdownColumn(
|
comments = columns.MarkdownColumn(
|
||||||
verbose_name=_('Comments'),
|
verbose_name=_('Comments'),
|
||||||
)
|
)
|
||||||
|
@ -380,7 +380,9 @@ class SiteGroupContactsView(ObjectContactsView):
|
|||||||
#
|
#
|
||||||
|
|
||||||
class SiteListView(generic.ObjectListView):
|
class SiteListView(generic.ObjectListView):
|
||||||
queryset = Site.objects.all()
|
queryset = Site.objects.annotate(
|
||||||
|
device_count=count_related(Device, 'site')
|
||||||
|
)
|
||||||
filterset = filtersets.SiteFilterSet
|
filterset = filtersets.SiteFilterSet
|
||||||
filterset_form = forms.SiteFilterForm
|
filterset_form = forms.SiteFilterForm
|
||||||
table = tables.SiteTable
|
table = tables.SiteTable
|
||||||
|
@ -19,6 +19,8 @@ class ImageAttachmentSerializer(ValidatedModelSerializer):
|
|||||||
queryset=ObjectType.objects.all()
|
queryset=ObjectType.objects.all()
|
||||||
)
|
)
|
||||||
parent = serializers.SerializerMethodField(read_only=True)
|
parent = serializers.SerializerMethodField(read_only=True)
|
||||||
|
image_width = serializers.IntegerField(read_only=True)
|
||||||
|
image_height = serializers.IntegerField(read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ImageAttachment
|
model = ImageAttachment
|
||||||
|
@ -31,7 +31,7 @@ class ReportForm(forms.Form):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Annotate the current system time for reference
|
# Annotate the current system time for reference
|
||||||
now = local_now().strftime('%Y-%m-%d %H:%M:%S')
|
now = local_now().strftime('%Y-%m-%d %H:%M:%S %Z')
|
||||||
self.fields['schedule_at'].help_text += _(' (current time: <strong>{now}</strong>)').format(now=now)
|
self.fields['schedule_at'].help_text += _(' (current time: <strong>{now}</strong>)').format(now=now)
|
||||||
|
|
||||||
# Remove scheduling fields if scheduling is disabled
|
# Remove scheduling fields if scheduling is disabled
|
||||||
|
@ -37,7 +37,7 @@ class ScriptForm(forms.Form):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Annotate the current system time for reference
|
# Annotate the current system time for reference
|
||||||
now = local_now().strftime('%Y-%m-%d %H:%M:%S')
|
now = local_now().strftime('%Y-%m-%d %H:%M:%S %Z')
|
||||||
self.fields['_schedule_at'].help_text += _(' (current time: <strong>{now}</strong>)').format(now=now)
|
self.fields['_schedule_at'].help_text += _(' (current time: <strong>{now}</strong>)').format(now=now)
|
||||||
|
|
||||||
# Remove scheduling fields if scheduling is disabled
|
# Remove scheduling fields if scheduling is disabled
|
||||||
|
BIN
netbox/project-static/dist/netbox.css
vendored
BIN
netbox/project-static/dist/netbox.css
vendored
Binary file not shown.
@ -30,6 +30,9 @@
|
|||||||
|
|
||||||
// Remove the bottom margin of <p> elements inside a table cell
|
// Remove the bottom margin of <p> elements inside a table cell
|
||||||
td > .rendered-markdown {
|
td > .rendered-markdown {
|
||||||
|
max-height: 200px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
|
||||||
p:last-of-type {
|
p:last-of-type {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
@ -113,11 +113,12 @@ class ContactAssignmentTable(NetBoxTable):
|
|||||||
)
|
)
|
||||||
contact_phone = tables.Column(
|
contact_phone = tables.Column(
|
||||||
accessor=Accessor('contact__phone'),
|
accessor=Accessor('contact__phone'),
|
||||||
verbose_name=_('Contact Phone')
|
verbose_name=_('Contact Phone'),
|
||||||
|
linkify=linkify_phone,
|
||||||
)
|
)
|
||||||
contact_email = tables.Column(
|
contact_email = tables.EmailColumn(
|
||||||
accessor=Accessor('contact__email'),
|
accessor=Accessor('contact__email'),
|
||||||
verbose_name=_('Contact Email')
|
verbose_name=_('Contact Email'),
|
||||||
)
|
)
|
||||||
contact_address = tables.Column(
|
contact_address = tables.Column(
|
||||||
accessor=Accessor('contact__address'),
|
accessor=Accessor('contact__address'),
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@ from django.contrib.contenttypes.models import ContentType
|
|||||||
from django.contrib.humanize.templatetags.humanize import naturalday, naturaltime
|
from django.contrib.humanize.templatetags.humanize import naturalday, naturaltime
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
from django.utils.timezone import localtime
|
||||||
from markdown import markdown
|
from markdown import markdown
|
||||||
from markdown.extensions.tables import TableExtension
|
from markdown.extensions.tables import TableExtension
|
||||||
|
|
||||||
@ -218,7 +219,8 @@ def isodate(value):
|
|||||||
text = value.isoformat()
|
text = value.isoformat()
|
||||||
return mark_safe(f'<span title="{naturalday(value)}">{text}</span>')
|
return mark_safe(f'<span title="{naturalday(value)}">{text}</span>')
|
||||||
elif type(value) is datetime.datetime:
|
elif type(value) is datetime.datetime:
|
||||||
text = value.date().isoformat()
|
local_value = localtime(value) if value.tzinfo else value
|
||||||
|
text = local_value.date().isoformat()
|
||||||
return mark_safe(f'<span title="{naturaltime(value)}">{text}</span>')
|
return mark_safe(f'<span title="{naturaltime(value)}">{text}</span>')
|
||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
@ -229,7 +231,8 @@ def isotime(value, spec='seconds'):
|
|||||||
if type(value) is datetime.time:
|
if type(value) is datetime.time:
|
||||||
return value.isoformat(timespec=spec)
|
return value.isoformat(timespec=spec)
|
||||||
if type(value) is datetime.datetime:
|
if type(value) is datetime.datetime:
|
||||||
return value.time().isoformat(timespec=spec)
|
local_value = localtime(value) if value.tzinfo else value
|
||||||
|
return local_value.time().isoformat(timespec=spec)
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user