Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: #17740 - Add webp to the list of acceptable extensions for handling filenames in image_upload #17785

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e7bd0e5
Closes #17776: Add support for different HTTP methods to HTMXSelect
jeremystretch Oct 16, 2024
35307d2
17468 add warning to documentation about overriding custom script pro…
arthanson Oct 16, 2024
aa3f4cb
17710 remove cached fields from CableTermination GraphQL
arthanson Oct 15, 2024
e8e95f5
Add job timeout handling in JobRunner for periodic jobs
miaow2 Oct 16, 2024
532dbab
Fixes #17749: Add missing graphql fields
corubba Oct 15, 2024
82de559
17754 fix per-page on version history (#17766)
arthanson Oct 16, 2024
27fcb8e
Add webp to the list of acceptable extensions for handling filenames …
bctiemann Oct 16, 2024
a320bda
16136 remove Django Admin (#17619)
arthanson Sep 27, 2024
cfb23ad
16783 Add status field to InventoryItem (#17627)
arthanson Sep 30, 2024
0544189
17195 Add color to PowerOutlet (#17623)
arthanson Oct 2, 2024
c2b5242
fix migrations
arthanson Oct 2, 2024
cda9e05
17476 Upgrade to Django 5.1 (#17620)
arthanson Oct 10, 2024
40fc025
16546 define get_absolute_url method in NetBoxModel (#17693)
arthanson Oct 10, 2024
e460843
Closes #17472: Deprecate the staged changes API
jeremystretch Oct 9, 2024
2a8101c
16547 Add distance to Circuit (#17629)
arthanson Oct 10, 2024
74876ac
Fix migrations conflict
jeremystretch Oct 11, 2024
24ec13c
Remove unused imports
jeremystretch Oct 11, 2024
9bb6598
Add webp to the list of acceptable extensions for handling filenames …
bctiemann Oct 16, 2024
e702e34
Merge remote-tracking branch 'origin/17740-add-webp-to-image_upload' …
bctiemann Oct 16, 2024
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
3 changes: 3 additions & 0 deletions docs/customization/custom-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ script_order = (MyCustomScript, AnotherCustomScript)

Script attributes are defined under a class named `Meta` within the script. These are optional, but encouraged.

!!! warning
These are also defined and used as properties on the base custom script class, so don't use the same names as variables or override them in your custom script.

### `name`

This is the human-friendly names of your script. If omitted, the class name will be used.
Expand Down
3 changes: 2 additions & 1 deletion netbox/dcim/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ModularComponentTemplateType(ComponentTemplateType):

@strawberry_django.type(
models.CableTermination,
exclude=('termination_type', 'termination_id'),
exclude=('termination_type', 'termination_id', '_device', '_rack', '_location', '_site'),
filters=CableTerminationFilter
)
class CableTerminationType(NetBoxObjectType):
Expand Down Expand Up @@ -243,6 +243,7 @@ class DeviceType(ConfigContextMixin, ImageAttachmentsMixin, ContactsMixin, NetBo
consoleserverports: List[Annotated["ConsoleServerPortType", strawberry.lazy('dcim.graphql.types')]]
poweroutlets: List[Annotated["PowerOutletType", strawberry.lazy('dcim.graphql.types')]]
frontports: List[Annotated["FrontPortType", strawberry.lazy('dcim.graphql.types')]]
devicebays: List[Annotated["DeviceBayType", strawberry.lazy('dcim.graphql.types')]]
modulebays: List[Annotated["ModuleBayType", strawberry.lazy('dcim.graphql.types')]]
services: List[Annotated["ServiceType", strawberry.lazy('ipam.graphql.types')]]
inventoryitems: List[Annotated["InventoryItemType", strawberry.lazy('dcim.graphql.types')]]
Expand Down
2 changes: 1 addition & 1 deletion netbox/extras/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def image_upload(instance, filename):

# Rename the file to the provided name, if any. Attempt to preserve the file extension.
extension = filename.rsplit('.')[-1].lower()
if instance.name and extension in ['bmp', 'gif', 'jpeg', 'jpg', 'png']:
if instance.name and extension in ['bmp', 'gif', 'jpeg', 'jpg', 'png', 'webp']:
filename = '.'.join([instance.name, extension])
elif instance.name:
filename = instance.name
Expand Down
2 changes: 2 additions & 0 deletions netbox/netbox/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def handle(cls, job, *args, **kwargs):
finally:
if job.interval:
new_scheduled_time = (job.scheduled or job.started) + timedelta(minutes=job.interval)
if job.object and getattr(job.object, "python_class", None):
kwargs["job_timeout"] = job.object.python_class.job_timeout
cls.enqueue(
instance=job.object,
user=job.user,
Expand Down
5 changes: 3 additions & 2 deletions netbox/templates/core/plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{% load helpers %}
{% load form_helpers %}
{% load i18n %}
{% load render_table from django_tables2 %}

{% block title %}{{ plugin.title_long }}{% endblock %}

Expand Down Expand Up @@ -93,8 +94,8 @@ <h2 class="card-header">{% trans "Plugin Details" %}</h2>
<div class="col col-6">
<div class="card">
<h2 class="card-header">{% trans "Version History" %}</h2>
<div class="htmx-container table-responsive" id="object_list">
{% include 'htmx/table.html' %}
<div class="table-responsive">
{% render_table table 'inc/table.html' %}
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions netbox/tenancy/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class TenantGroupType(OrganizationalObjectType):
parent: Annotated["TenantGroupType", strawberry.lazy('tenancy.graphql.types')] | None

tenants: List[TenantType]
children: List[Annotated["TenantGroupType", strawberry.lazy('tenancy.graphql.types')]]


#
Expand Down Expand Up @@ -99,6 +100,7 @@ class ContactGroupType(OrganizationalObjectType):
parent: Annotated["ContactGroupType", strawberry.lazy('tenancy.graphql.types')] | None

contacts: List[ContactType]
children: List[Annotated["ContactGroupType", strawberry.lazy('tenancy.graphql.types')]]


@strawberry_django.type(
Expand Down
7 changes: 5 additions & 2 deletions netbox/utilities/forms/widgets/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ class HTMXSelect(forms.Select):
"""
Selection widget that will re-generate the HTML form upon the selection of a new option.
"""
def __init__(self, hx_url='.', hx_target_id='form_fields', attrs=None, **kwargs):
def __init__(self, method='get', hx_url='.', hx_target_id='form_fields', attrs=None, **kwargs):
method = method.lower()
if method not in ('delete', 'get', 'patch', 'post', 'put'):
raise ValueError(f"Unsupported HTTP method: {method}")
_attrs = {
'hx-get': hx_url,
f'hx-{method}': hx_url,
'hx-include': f'#{hx_target_id}',
'hx-target': f'#{hx_target_id}',
}
Expand Down
1 change: 1 addition & 0 deletions netbox/wireless/graphql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class WirelessLANGroupType(OrganizationalObjectType):
parent: Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')] | None

wireless_lans: List[Annotated["WirelessLANType", strawberry.lazy('wireless.graphql.types')]]
children: List[Annotated["WirelessLANGroupType", strawberry.lazy('wireless.graphql.types')]]


@strawberry_django.type(
Expand Down