internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: netbox-community/netbox

Issue:
Add L2VPN identifier field to the search index for L2VPN objects
### NetBox version

v3.7.4

### Feature type

Change to existing functionality

### Proposed functionality

Add the `identifier` field of `L2VPN` to the corresponding SearchIndex, so that it's possible to enter an L2VPN identifier into the global search and turn up the corresponding L2VPN object in the results.

### Use case

We use the `identifier` field of `L2VPN` to note a vxlan id.
It would be nice to also see the l2vpn, when we search for the vxlan id.

![image](https://github.com/netbox-community/netbox/assets/40308458/1abf8a74-3a5b-4191-ab79-9a765fcf1a5b)


#13927 exists, but the issue was also about making the identifier unique & required.

### Database changes

_No response_

### External dependencies

_No response_


Discussion:
Thanks for your interest in helping improve NetBox.

I've moved this issue into `needs owner` status. If you are interested in working it through to a PR, let us know and we'll assign the issue to you. Otherwise, any developer with the skills and capacity can request to work on it.
Thanks. I'm interested in doing the PR
Thanks @rwxd, I've assigned this to you.

Resolving patch:
diff --git a/netbox/vpn/search.py b/netbox/vpn/search.py
--- a/netbox/vpn/search.py
+++ b/netbox/vpn/search.py
@@ -75,6 +75,7 @@ class L2VPNIndex(SearchIndex):
     fields = (
         ('name', 100),
         ('slug', 110),
+        ('identifier', 200),
         ('description', 500),
         ('comments', 5000),
     )


Test patch:
Repository: netbox-community/netbox

Issue:
Add 5G as an option to the Cellular device interface section
### NetBox version

v3.7.4

### Feature type

Change to existing functionality

### Proposed functionality

With reference to [Interface Type Additions for LTE Standards #2866](https://github.com/netbox-community/netbox/issues/2866) could we add 5G to list of cellular interface types to differentiate those devices that support 5G as apposed to 4G/LTE.

### Use case

We are rolling out [Cradlepoint W1850](https://cradlepoint.com/product/endpoints/w1850-series/) 5G devices and would like to differentiate 5G devices from older LTE models.

### Database changes

_No response_

### External dependencies

_No response_


Discussion:
Could you please assign this task to me?


Resolving patch:
diff --git a/netbox/dcim/choices.py b/netbox/dcim/choices.py
--- a/netbox/dcim/choices.py
+++ b/netbox/dcim/choices.py
@@ -892,6 +892,8 @@ class InterfaceTypeChoices(ChoiceSet):
     TYPE_GSM = 'gsm'
     TYPE_CDMA = 'cdma'
     TYPE_LTE = 'lte'
+    TYPE_4G = '4g'
+    TYPE_5G = '5g'
 
     # SONET
     TYPE_SONET_OC3 = 'sonet-oc3'
@@ -1060,6 +1062,8 @@ class InterfaceTypeChoices(ChoiceSet):
                 (TYPE_GSM, 'GSM'),
                 (TYPE_CDMA, 'CDMA'),
                 (TYPE_LTE, 'LTE'),
+                (TYPE_4G, '4G'),
+                (TYPE_5G, '5G'),
             )
         ),
         (


Test patch:
Repository: netbox-community/netbox

Issue:
Add the ability to configure HSTS in NetBox
### NetBox version

v3.7.3

### Feature type

New functionality

### Proposed functionality

Currently NetBox does not have configuration entries for HSTS.  In order to enable this security feature it is necessary to set the following Django settings (see https://docs.djangoproject.com/en/5.0/ref/middleware/#http-strict-transport-security)

The recommend change to settings.py:
```
SECURE_HSTS_SECONDS =  getattr(configuration, 'SECURE_HSTS_SECONDS', 0) 
SECURE_HSTS_INCLUDE_SUBDOMAINS = getattr(configuration, 'SECURE_HSTS_INCLUDE_SUBDOMAINS', False)
SECURE_HSTS_PRELOAD = getattr(configuration, 'SECURE_HSTS_PRELOAD', False)
```

### Use case

Add the ability to enable HSTS in configuration.py.

### Database changes

None

### External dependencies

None


Discussion:
Please, could you assign it to me?



Resolving patch:
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -160,6 +160,9 @@
 RQ_RETRY_MAX = getattr(configuration, 'RQ_RETRY_MAX', 0)
 SCRIPTS_ROOT = getattr(configuration, 'SCRIPTS_ROOT', os.path.join(BASE_DIR, 'scripts')).rstrip('/')
 SEARCH_BACKEND = getattr(configuration, 'SEARCH_BACKEND', 'netbox.search.backends.CachedValueSearchBackend')
+SECURE_HSTS_INCLUDE_SUBDOMAINS = getattr(configuration, 'SECURE_HSTS_INCLUDE_SUBDOMAINS', False)
+SECURE_HSTS_PRELOAD = getattr(configuration, 'SECURE_HSTS_PRELOAD', False)
+SECURE_HSTS_SECONDS = getattr(configuration, 'SECURE_HSTS_SECONDS', 0)
 SECURE_SSL_REDIRECT = getattr(configuration, 'SECURE_SSL_REDIRECT', False)
 SENTRY_DSN = getattr(configuration, 'SENTRY_DSN', None)
 SENTRY_ENABLED = getattr(configuration, 'SENTRY_ENABLED', False)


Test patch:
Repository: netbox-community/netbox

Issue:
Migration "Applying users.0006_custom_group_model" to 4.0-beta1 fails
### Deployment Type

Self-hosted

### NetBox Version

v4.0-beta1 (89dd4230807bf5d8f6de586d86120d8148d23eb1)

### Python Version

3.11

### Steps to Reproduce

1. Netbox setup with 3.7.5 (upgraded from 2.5)
2. Migrate to `v4.0-beta1 (89dd4230807bf5d8f6de586d86120d8148d23eb1)`

### Expected Behavior

Successful run of all migrations

### Observed Behavior

Migration `Applying users.0006_custom_group_model` fails with this error:
```
psycopg.errors.ForeignKeyViolation: update or delete on table "auth_group" violates foreign key constraint "auth_group_permissions_group_id_b120cbf9_fk_auth_group_id" on table "auth_group_permissions"
DETAIL:  Key (id)=(10) is still referenced from table "auth_group_permissions".
```

Table list pre migration: https://gist.github.com/tobiasge/382ec52aaca740b622d480c75f95acf6#file-3-7-5-table-list-txt
Full stack trace: https://gist.github.com/tobiasge/382ec52aaca740b622d480c75f95acf6#file-exception-txt
Table list after migration try: https://gist.github.com/tobiasge/382ec52aaca740b622d480c75f95acf6#file-4-0-beta-table-list-txt





Discussion:
@tobiasge it looks like you have one or more legacy permissions in the `auth_group_permissions` table referencing the stock Group model. NetBox moved to a custom object-based permission model back in v2.9, and the legacy permissions are no longer used for anything. There was a [migration](https://github.com/netbox-community/netbox/blob/v2.9.0/netbox/users/migrations/0009_replicate_permissions.py) to copy the legacy permissions into the new table but I don't believe the old ones were ever deleted.

Could you try clearing out that table and re-running the v4.0 migration? (`DELETE FROM auth_group_permissions` in the `dbshell` should do it.)
```sql
DELETE FROM auth_group_permissions
DELETE 627
```
After this the `Applying users.0006_custom_group_model` was successful.

Resolving patch:
diff --git a/netbox/users/migrations/0006_custom_group_model.py b/netbox/users/migrations/0006_custom_group_model.py
--- a/netbox/users/migrations/0006_custom_group_model.py
+++ b/netbox/users/migrations/0006_custom_group_model.py
@@ -63,6 +63,11 @@ class Migration(migrations.Migration):
             field=models.ManyToManyField(blank=True, related_name='object_permissions', to='users.group'),
         ),
 
+        # Delete any lingering group assignments for legacy permissions (from before NetBox v2.9)
+        migrations.RunSQL(
+            "DELETE from auth_group_permissions"
+        ),
+
         # Delete groups from the old table
         migrations.RunSQL(
             "DELETE from auth_group"


Test patch:
Repository: netbox-community/netbox

Issue:
Remove configuration parameters date & time formatting
### Proposed Changes

Remove the following configuration parameters:

- `DATE_FORMAT`
- `DATETIME_FORMAT`
- `SHORT_DATE_FORMAT`
- `SHORT_DATETIME_FORMAT`
- `SHORT_TIME_FORMAT`
- `TIME_FORMAT`

### Justification

Per #15735, NetBox will now display all dates & times in ISO 8601 format consistently, regardless of configuration or locale. These configuration parameters are no longer needed.

### Impact

As Django 5.0 and later enforces localization of dates & times by default, these settings generally have no effect anyway (as noted in #15618).


Discussion:

Resolving patch:
diff --git a/netbox/netbox/configuration_example.py b/netbox/netbox/configuration_example.py
--- a/netbox/netbox/configuration_example.py
+++ b/netbox/netbox/configuration_example.py
@@ -237,12 +237,3 @@
 
 # Time zone (default: UTC)
 TIME_ZONE = 'UTC'
-
-# Date/time formatting. See the following link for supported formats:
-# https://docs.djangoproject.com/en/stable/ref/templates/builtins/#date
-DATE_FORMAT = 'N j, Y'
-SHORT_DATE_FORMAT = 'Y-m-d'
-TIME_FORMAT = 'g:i a'
-SHORT_TIME_FORMAT = 'H:i:s'
-DATETIME_FORMAT = 'N j, Y g:i a'
-SHORT_DATETIME_FORMAT = 'Y-m-d H:i'
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -73,8 +73,6 @@
 CSRF_TRUSTED_ORIGINS = getattr(configuration, 'CSRF_TRUSTED_ORIGINS', [])
 DATA_UPLOAD_MAX_MEMORY_SIZE = getattr(configuration, 'DATA_UPLOAD_MAX_MEMORY_SIZE', 2621440)
 DATABASE = getattr(configuration, 'DATABASE')  # Required
-DATE_FORMAT = getattr(configuration, 'DATE_FORMAT', 'N j, Y')
-DATETIME_FORMAT = getattr(configuration, 'DATETIME_FORMAT', 'N j, Y g:i a')
 DEBUG = getattr(configuration, 'DEBUG', False)
 DEFAULT_DASHBOARD = getattr(configuration, 'DEFAULT_DASHBOARD', None)
 DEFAULT_PERMISSIONS = getattr(configuration, 'DEFAULT_PERMISSIONS', {
@@ -152,12 +150,8 @@
 SESSION_COOKIE_PATH = CSRF_COOKIE_PATH
 SESSION_COOKIE_SECURE = getattr(configuration, 'SESSION_COOKIE_SECURE', False)
 SESSION_FILE_PATH = getattr(configuration, 'SESSION_FILE_PATH', None)
-SHORT_DATE_FORMAT = getattr(configuration, 'SHORT_DATE_FORMAT', 'Y-m-d')
-SHORT_DATETIME_FORMAT = getattr(configuration, 'SHORT_DATETIME_FORMAT', 'Y-m-d H:i')
-SHORT_TIME_FORMAT = getattr(configuration, 'SHORT_TIME_FORMAT', 'H:i:s')
 STORAGE_BACKEND = getattr(configuration, 'STORAGE_BACKEND', None)
 STORAGE_CONFIG = getattr(configuration, 'STORAGE_CONFIG', {})
-TIME_FORMAT = getattr(configuration, 'TIME_FORMAT', 'g:i a')
 TIME_ZONE = getattr(configuration, 'TIME_ZONE', 'UTC')
 
 # Load any dynamic configuration parameters which have been hard-coded in the configuration file


Test patch:
Repository: netbox-community/netbox

Issue:
Remove the `ENABLE_LOCALIZATION` configuration parameter
### Proposed Changes

Remove support for the `ENABLE_LOCALIZATION` configuration parameter. As a result of removing this parameter, the Django setting [`USE_I18N`]() will default to True, and `LocaleMiddleware` will always be enabled.

### Justification

As localization is now [enforced in Django 5.0](https://docs.djangoproject.com/en/5.0/releases/4.0/#localization) and NetBox restricts the set of available translation languages to those for which string maps have been generated, this setting is no longer needed.

### Impact

Translation and localization will always be enabled.


Discussion:

Resolving patch:
diff --git a/netbox/netbox/configuration_example.py b/netbox/netbox/configuration_example.py
--- a/netbox/netbox/configuration_example.py
+++ b/netbox/netbox/configuration_example.py
@@ -131,9 +131,6 @@
     'FROM_EMAIL': '',
 }
 
-# Localization
-ENABLE_LOCALIZATION = False
-
 # Exempt certain models from the enforcement of view permissions. Models listed here will be viewable by all users and
 # by anonymous users. List models in the form `<app>.<model>`. Add '*' to this list to exempt all models.
 EXEMPT_VIEW_PERMISSIONS = [
diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py
--- a/netbox/netbox/settings.py
+++ b/netbox/netbox/settings.py
@@ -91,7 +91,6 @@
 DJANGO_ADMIN_ENABLED = getattr(configuration, 'DJANGO_ADMIN_ENABLED', False)
 DOCS_ROOT = getattr(configuration, 'DOCS_ROOT', os.path.join(os.path.dirname(BASE_DIR), 'docs'))
 EMAIL = getattr(configuration, 'EMAIL', {})
-ENABLE_LOCALIZATION = getattr(configuration, 'ENABLE_LOCALIZATION', False)
 EVENTS_PIPELINE = getattr(configuration, 'EVENTS_PIPELINE', (
     'extras.events.process_event_queue',
 ))
@@ -385,8 +384,6 @@ def _setting(name, default=None):
     'netbox.middleware.MaintenanceModeMiddleware',
     'django_prometheus.middleware.PrometheusAfterMiddleware',
 ]
-if not ENABLE_LOCALIZATION:
-    MIDDLEWARE.remove('django.middleware.locale.LocaleMiddleware')
 
 # URLs
 ROOT_URLCONF = 'netbox.urls'
@@ -711,8 +708,6 @@ def _setting(name, default=None):
 LOCALE_PATHS = (
     BASE_DIR + '/translations',
 )
-if not ENABLE_LOCALIZATION:
-    USE_I18N = False
 
 #
 # Strawberry (GraphQL)


Test patch:
Repository: netbox-community/netbox

Issue:
Remove the `annotated_date()` and `annotated_now()` template filters
### Proposed Changes

Remove the following template filters from `utilities.templatetags.helpers`:

- `annotated_date()`
- `annotated_now()`

### Justification

With the shift to using ISO 8601-formatted dates & times everywhere in #15735, these filters are no longer needed.

### Impact

All uses of these filters must be updated. These can generally be replaced with the new `isodatetime()` template filter.


Discussion:

Resolving patch:
diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py
--- a/netbox/utilities/templatetags/helpers.py
+++ b/netbox/utilities/templatetags/helpers.py
@@ -15,8 +15,6 @@
 from utilities.views import get_viewname
 
 __all__ = (
-    'annotated_date',
-    'annotated_now',
     'applied_filters',
     'as_range',
     'divide',
@@ -105,34 +103,6 @@ def humanize_megabytes(mb):
     return f'{mb} MB'
 
 
-@register.filter(expects_localtime=True)
-def annotated_date(date_value):
-    """
-    Returns date as HTML span with short date format as the content and the
-    (long) date format as the title.
-    """
-    if not date_value:
-        return ''
-
-    if type(date_value) is datetime.date:
-        long_ts = date(date_value, 'DATE_FORMAT')
-        short_ts = date(date_value, 'SHORT_DATE_FORMAT')
-    else:
-        long_ts = date(date_value, 'DATETIME_FORMAT')
-        short_ts = date(date_value, 'SHORT_DATETIME_FORMAT')
-
-    return mark_safe(f'<span title="{long_ts}">{short_ts}</span>')
-
-
-@register.simple_tag
-def annotated_now():
-    """
-    Returns the current date piped through the annotated_date filter.
-    """
-    tzinfo = timezone.get_current_timezone() if settings.USE_TZ else None
-    return annotated_date(datetime.datetime.now(tz=tzinfo))
-
-
 @register.filter()
 def divide(x, y):
     """


Test patch:
Repository: netbox-community/netbox

Issue:
Add Image Attachments to Virtual Machines
### NetBox version

4.0

### Feature type

New functionality

### Proposed functionality

Extend virtual machines with the ability to add image attachments.

1. Inherit the ImageAttachmentsMixin in the  VirtualMachine model.
2. Add the required template to the object view for VMs

https://github.com/Hedius/netbox/tree/15712-add_imageattachments_to_virtualmachines

### Use case

I acknowledge that this feature (according to the FAQ) is or was initially meant for uploading photos of hardware and racks.

Our NetBox partly evolved into us uploading diagrams etc. into devices to extend the comment section with them.
(We document there what a host / server is doing etc.)
It would be a nice to have if we can do the same in virtual machines.
Main advantage is that you have those images directly linked to the host.

I do not know how other organizations use this feature, but having the same abilities for bare metal servers and virtual machines seems right to me.

Would this change be acceptable to you?

Adding the modal to VMs would not extend the complexity of NetBox.

### Database changes

None

### External dependencies

None


Discussion:

Resolving patch:
diff --git a/netbox/virtualization/models/virtualmachines.py b/netbox/virtualization/models/virtualmachines.py
--- a/netbox/virtualization/models/virtualmachines.py
+++ b/netbox/virtualization/models/virtualmachines.py
@@ -15,7 +15,7 @@
 from extras.querysets import ConfigContextModelQuerySet
 from netbox.config import get_config
 from netbox.models import NetBoxModel, PrimaryModel
-from netbox.models.features import ContactsMixin
+from netbox.models.features import ContactsMixin, ImageAttachmentsMixin
 from utilities.fields import CounterCacheField, NaturalOrderingField
 from utilities.ordering import naturalize_interface
 from utilities.query_functions import CollateAsChar
@@ -29,7 +29,7 @@
 )
 
 
-class VirtualMachine(ContactsMixin, RenderConfigMixin, ConfigContextModel, PrimaryModel):
+class VirtualMachine(ContactsMixin, ImageAttachmentsMixin, RenderConfigMixin, ConfigContextModel, PrimaryModel):
     """
     A virtual machine which runs inside a Cluster.
     """


Test patch:
Repository: netbox-community/netbox

Issue:
New User model has a 32-bit integer `id` field
### Deployment Type

NetBox Cloud

### NetBox Version

v4.0-beta1

### Python Version

3.10

### Steps to Reproduce

1. Upgrade a v3.7 database to v4.0
2. Inspect the `users_user` table

### Expected Behavior

The `id` column of the `users_user` table should be a `bigint` (64-bit integer), like all other models in NetBox.

### Observed Behavior

The `id` column is a regular 32-bit integer. This is because we renamed the stock Django table, which uses a 32-bit integer `id` field.


Discussion:

Resolving patch:
diff --git a/netbox/users/migrations/0005_alter_user_table.py b/netbox/users/migrations/0005_alter_user_table.py
--- a/netbox/users/migrations/0005_alter_user_table.py
+++ b/netbox/users/migrations/0005_alter_user_table.py
@@ -33,6 +33,9 @@ class Migration(migrations.Migration):
             table=None,
         ),
 
+        # Convert the `id` column to a 64-bit integer (BigAutoField is implied by DEFAULT_AUTO_FIELD)
+        migrations.RunSQL("ALTER TABLE users_user ALTER COLUMN id TYPE bigint"),
+
         # Rename auth_user_* sequences
         migrations.RunSQL("ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq"),
         migrations.RunSQL("ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq"),


Test patch:
Repository: netbox-community/netbox

Issue:
The comments field for event rules does not support live preview
### Deployment Type

NetBox Cloud

### NetBox Version

v3.7.5

### Python Version

3.10

### Steps to Reproduce

1. Navigate to event rules > Add.
2. Enter the required fields and some text in the comments field.
3. Attempt to preview the content as with similar objects.

### Expected Behavior

There should be a "Preview" tab above the comments field.

### Observed Behavior

There is no preview tab.


Discussion:

Resolving patch:
diff --git a/netbox/extras/forms/model_forms.py b/netbox/extras/forms/model_forms.py
--- a/netbox/extras/forms/model_forms.py
+++ b/netbox/extras/forms/model_forms.py
@@ -265,6 +265,7 @@ class EventRuleForm(NetBoxModelForm):
         required=False,
         help_text=_('Enter parameters to pass to the action in <a href="https://json.org/">JSON</a> format.')
     )
+    comments = CommentField()
 
     fieldsets = (
         (_('Event Rule'), ('name', 'description', 'content_types', 'enabled', 'tags')),


Test patch:
Repository: netbox-community/netbox

Issue:
Tags Bulk Importer - Allow specifying the id column to bulk update existing tags
### NetBox version

v3.7.5

### Feature type

Data model extension

### Proposed functionality

Allow field option `id` of the existing tags. Currently only columns "name;slug;color;description" are allowed when using the importer.

![image](https://github.com/netbox-community/netbox/assets/1938389/2f06a820-da72-4f8d-b9cb-1f2c851d0973)


### Use case

to be able to bulk update tags using the "Tag Bulk Import"at `https://demo.netbox.dev/extras/tags/import/`

### Database changes

None

### External dependencies

None


Discussion:
FYI this functionality is supported today. It's just that the `id` field isn't listed as a supported column in the reference panel.
> It's just that the `id` field isn't listed as a supported column in the reference panel.

Oh :open_mouth: I see :sweat_smile: 
I tested, and if you add an "id" of an existing TAG, that tag will be updated; that is, the functionality exists. Adding instructions for the bulk update may be suitable.

Resolving patch:
diff --git a/netbox/netbox/forms/base.py b/netbox/netbox/forms/base.py
--- a/netbox/netbox/forms/base.py
+++ b/netbox/netbox/forms/base.py
@@ -73,11 +73,6 @@ class NetBoxModelImportForm(CSVModelForm, NetBoxModelForm):
     """
     Base form for creating a NetBox objects from CSV data. Used for bulk importing.
     """
-    id = forms.IntegerField(
-        label=_('Id'),
-        required=False,
-        help_text='Numeric ID of an existing object to update (if not creating a new object)'
-    )
     tags = CSVModelMultipleChoiceField(
         label=_('Tags'),
         queryset=Tag.objects.all(),
diff --git a/netbox/utilities/forms/forms.py b/netbox/utilities/forms/forms.py
--- a/netbox/utilities/forms/forms.py
+++ b/netbox/utilities/forms/forms.py
@@ -70,6 +70,12 @@ class CSVModelForm(forms.ModelForm):
     """
     ModelForm used for the import of objects in CSV format.
     """
+    id = forms.IntegerField(
+        label=_('ID'),
+        required=False,
+        help_text=_('Numeric ID of an existing object to update (if not creating a new object)')
+    )
+
     def __init__(self, *args, headers=None, **kwargs):
         self.headers = headers or {}
         super().__init__(*args, **kwargs)


Test patch:
Repository: netbox-community/netbox

Issue:
HTMX: Bulk actions in ObjectListView without function
### Deployment Type

Self-hosted

### NetBox Version

v4.0-beta1

### Python Version

3.11

### Steps to Reproduce

1. Set user preferences to HTMX Navigation enabled
2. Create two or more IP addresses
3. Select the IP addresses in list view
4. Click on "Edit Selected" or "Delete Selected"

### Expected Behavior

For "Edit Selected", the bulk edit form opens. For "Delete Selected", the usual "xxx Objects will be deleted" confirmation dialog appears.

### Observed Behavior

Nothing at all happens.

With "HTMX Navigation" set to "disabled", everything works as usual.


Discussion:

Resolving patch:
diff --git a/netbox/utilities/templatetags/buttons.py b/netbox/utilities/templatetags/buttons.py
--- a/netbox/utilities/templatetags/buttons.py
+++ b/netbox/utilities/templatetags/buttons.py
@@ -152,8 +152,8 @@ def export_button(context, model):
     }
 
 
-@register.inclusion_tag('buttons/bulk_edit.html')
-def bulk_edit_button(model, action='bulk_edit', query_params=None):
+@register.inclusion_tag('buttons/bulk_edit.html', takes_context=True)
+def bulk_edit_button(context, model, action='bulk_edit', query_params=None):
     try:
         url = reverse(get_viewname(model, action))
         if query_params:
@@ -162,12 +162,13 @@ def bulk_edit_button(model, action='bulk_edit', query_params=None):
         url = None
 
     return {
+        'htmx_navigation': context.get('htmx_navigation'),
         'url': url,
     }
 
 
-@register.inclusion_tag('buttons/bulk_delete.html')
-def bulk_delete_button(model, action='bulk_delete', query_params=None):
+@register.inclusion_tag('buttons/bulk_delete.html', takes_context=True)
+def bulk_delete_button(context, model, action='bulk_delete', query_params=None):
     try:
         url = reverse(get_viewname(model, action))
         if query_params:
@@ -176,5 +177,6 @@ def bulk_delete_button(model, action='bulk_delete', query_params=None):
         url = None
 
     return {
+        'htmx_navigation': context.get('htmx_navigation'),
         'url': url,
     }


Test patch: