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

[next] Add isnull Filter on Nullable Fields via Filter Field Factory #4635

Merged
merged 7 commits into from
Oct 12, 2023

Conversation

glennmatthews
Copy link
Contributor

Closes: #1905

What's Changed

This is a rebase of @itdependsnetworks' #4378 to target next rather than develop, plus it includes a RoleFilter fix based on @snaselj's comment on that PR.

For whatever reason the StatusFilter and RoleFilter code were completely different; I've included changes to bring them more in line with one another as a part of this fix. As a side benefit, StatusFilter has changed from a ModelMultipleChoiceFilter to a NaturalKeyOrPKMultipleChoiceFilter, meaning that it can now filter by id as well as by name (previously it was name only).

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • n/a Example Plugin Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@itdependsnetworks
Copy link
Contributor

@glennmatthews thanks for this!!

@glennmatthews glennmatthews self-assigned this Oct 11, 2023
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>
@glennmatthews glennmatthews merged commit 70cc966 into next Oct 12, 2023
21 checks passed
@glennmatthews glennmatthews deleted the u/glennmatthews-1905-isnull branch October 12, 2023 13:29
timizuoebideri1 pushed a commit that referenced this pull request Oct 13, 2023
…4635)

* Added the ability to automatically apply `isnull` filters when model field is nullable

* check field first with hasattr

* Account for oddness with RoleFilter

* Update test to account for a boolean in schema

* Update test to account for a boolean in schema take 2

* Fix issues with RoleFilter, align StatusFilter and RoleFilter code paths.

Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>

* Update nautobot/core/filters.py

Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

---------

Co-authored-by: itdependsnetworks <ken@celenza.org>
Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>
glennmatthews added a commit that referenced this pull request Dec 21, 2023
* Seed version 2.1.0b1

* Update API versioning tests to support 2.1 API version

* [next] Add isnull Filter on Nullable Fields via Filter Field Factory (#4635)

* Added the ability to automatically apply `isnull` filters when model field is nullable

* check field first with hasattr

* Account for oddness with RoleFilter

* Update test to account for a boolean in schema

* Update test to account for a boolean in schema take 2

* Fix issues with RoleFilter, align StatusFilter and RoleFilter code paths.

Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>

* Update nautobot/core/filters.py

Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

---------

Co-authored-by: itdependsnetworks <ken@celenza.org>
Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

* Implemented Django admin log entries in admin. (#4646)

- Added `LogEntryAdmin` that asserts a read-only view of `LogEntry` admin logs.
- Revised Change Logging documentation to describe both admin and change logging.
- Updated `ObjectPermission.object_types.limit_choices_to` to allow `auth.LogEntry`
- Fixed a bug in `ObjectPermission.object_types.limit_choices_to` where filtering on `auth.User` should be `users.User`

* LESS variables and Bootstrap changes for Nautobot UI Reskin (#4691)

* first commit

* save progress so far

* save progress so far

* change text-muted color

* more html changes

* feature: introduce bootstrap 3 nautobot theme

* chore: clean up dev work done during implementing bootstrap 3 nautobot skin

* changelog

* fix: serve ubuntu mono font from static files

---------

Co-authored-by: Norbert Mieczkowski <norbert.mieczkowski@codilime.com>

* Show user that created and last updated object in advanced tab (#4711)

* first commit

* address feedback

* switch approach to query ObjectChange records instead

* remove unused import

* add unittests

* fix unittests

* flake8 and pylint

* address PR feedback

* address feedback

* address PR feedback

* Job file output (#4723)

* Add shared volume to docker-compose, add example file output job

* Add JOB_STORAGE_BACKEND setting and basic support for non-database-backed storage of job files

* Docs updates

* Linting

* Change fragments

* Docs updates

* Basic success-path unit test

* Update nautobot/docs/release-notes/version-2.1.md

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

* Change JOB_STORAGE_BACKEND to JOB_FILE_IO_STORAGE

* Add docstring and logging to create_file() API, add link on main jobresult info

* Docstring fix

---------

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

* Data Export as system Job (#4746)

* Create ExportObjectList system Job

* Update export button templatetag/template

* Refine job logging, update export-button template

* Refinements

* Refinements and initial test cases

* Template refinement, additional tests

* Change fragments

* Add 3.0 TODO comments to remove now-unneeded code

* Add to release overview

* Update nautobot/docs/release-notes/version-2.1.md

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

---------

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

* Add external integration model (#4740)

* Refine button, and table

* and change logs

* feature: move navbar to the left (#4765)

* feature: move navbar to the left

* fix: excessive body left padding

* chore: add changelog

* fix: integration tests

* fix: integration tests

* fix: indentation

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* chore: add comment

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* chore: add comment

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* chore: add removed changelog

* chore: rename ntc_thumbnail.svg to nautobot_chevron.svg

* chore: fix incorrect indents in nav_menu.html file

* chore: clean up navbar css

* feature: truncate long usernames with css

* chore: remove a part of navbar form render condition

Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

* fix: outdated tests

* fix: failing test

* Update docs and settings to allow overriding the nautobot_chevron image as part of custom branding

* Black

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

* Update changes/4786.housekeeping

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

* Use rgb for uniformity and use background color instead of transparent for btn

* CSS Refinement to Bootstrap UI (#4775)

* initial changes

* added nautobot_chevron icon to page headers

* table border changes

* table template

* add nautobot_chevron to detail templates

* move copy button to object_retrieve.html title

* unittests

* unittests, for real this time

* extras unittests

* object.display->object

* passing unittests and change link and badge color to darker blue

* insert nautobot_chevron_header via css

* minor changes

* Update nautobot/core/templates/generic/object_retrieve.html

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* solved panel table within a panel

* added template.css file and moved ubuntu file and header insertion css there

* fixed dynamic link of template.css

* invert table settings to include panel class

* use existing panel_table.html instead

* modify strict filtering test

* flake8 and unittests

* add header_bullet and used nautobot_chevron.svg instead of nautobot_chevron_header.svg

* changelog

* restore nautobot_chevron_header.svg

* remove unnecessary changes

* try to fix markdownlint

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* change logs mod

* Gherkin feature/workflow writeups for LocationType/Location and Namespace/Prefix (#4803)

* Gherkin feature writeups for LocationType/Location and Namespace/Prefix

* Apply suggestions from code review

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

---------

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

* Fix 4816 (#4818)

* Fix dark mode navbar link colors

* Add space between button rows

* Update modal theme screenshots

* Fix table row background color

* Add changelog

* Update row background color to match homepage

* Fix nav-tabs border in dark mode

* Adjust text color

* Fix selected text bug with iGraphQL page

* Fix black background for Swagger API doc rows

* fix minor template error

---------

Co-authored-by: Hanlin Miao <hanlin980505@gmail.com>

* fix ruff

* Added bulk edit and bulk destroy views to Namespaces. (#4848)

* fix test

* fix tests

* Removed support for `HIDE_RESTRICTED_UI` config.

* fix unittest

* setting content type FK to set_null (#4863)

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

* Make NavItem link text `margin-right` slightly larger. (#4859)

* make NavItem link text margin-right slightly larger

* changelog

* Add REST API for downloading FileProxy objects (#4860)

* Add REST API for downloading FileProxy objects. Fixes #4820

* isort

* Apply suggestions from code review

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Apply suggestions from code review

* Update nautobot/core/api/views.py

* Fix integration test

* Resolve PR feedback

* Add change logs

* Update views.py

* Update test_plugin_home.py

* Added InterfaceRedundancyGroupAssociation to GraphQL. (#4861)

* Added InterfaceRedundancyGroupAssociation to GraphQL.

* revert fixes for get_absolute_url()

* added other m2m models to GraphQL

* black and flake8

* revert unnecessary changes

* flake8

* unittest

* Add table_inc_template to panel_table.html (#4882)

* Add table_inc_template to panel_table.html

* Change fragment

* update rendering of tooltips

* update references in integration tests to point to correct elements post  method

* Release v2.1.0-b1 (#4885)

* release v2.1.0b1

* version bumps

* add #4882

* correct version number

* add markdownlint disable

* revert changes to package-lock.json

* add #4677 and #4765 to release overview

* release overview

* Update nautobot/docs/release-notes/version-2.1.md

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* [2.1] Drop support for PostgreSQL versions before 12.0 (#4910)

* Drop support for PostgreSQL versions before 12.0

* Apply suggestions from code review

Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

---------

Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

* Update theme colors to match Nautobot branding (#4900)

* Update theme colors to match Nautobot branding

* Black

* Enhance theme preview view, fix bug in export button, change preview URL

* Additional change fragment

* Update docs

* Lighten various border colors as well as pagination background

* Refine paginator colors

* Add paginator to theme preview

* Add home page panel, explanatory text on headings to theme-preview

* Fix #4835 - address color of disabled text fields in forms

* Address review feedback

* Provides ability to reverse from IPAddress to the custom through table IPAddressToInterface (#4894)

* provides ability to reverse from IPAddress to the custom through table IPAddressToInterface

* Update 4893.added

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

* Fix custom field choice display in edit form (#4934)

* Fix custom field choice display in edit form

* Fix dynamic group child groups display too

* Fixed JSON custom field being returned as a repr() string

* Fix #4888 (#4936)

* Added `http_method`, `headers` and `ca_file_path` fields to `ExternalIntegration` model. (#4929)

* added extra fields to ExternalIntegration model

* changelog

* add jinja2 render template methods

* added accordion toggle to ExternalIntegrationForm

* black

* fix schema checks

* address PR feedback and fix unittest

* delete filter test for ca_file_path

* check migration test

* added factory boy attributes

* unittests for render_* helper functions

* flake8

* fix unittests

* fix unittests

* fix unittests

* address PR feedback

* address PR feedback and unittest

* mysql unittests

* flaky unittests

* flake8

* address PR feedback

* restore first and last name attributes on UserFactory

* Documented Django Admin Log Entries in v2.1 Release Overview. (#4953)

* Documented Django Admin Log Entries in v2.1 Release Overview.

* address PR feedback

* Added VRF to interface bulk edit form. (#4957)

* Bump version

* Documented `isnull` filter expression in v2.1 Release Overview (#4971)

* Documented isnull filter expression in v2.1 Release Overview

* issue number

* Update nautobot/docs/release-notes/version-2.1.md

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Update nautobot/docs/release-notes/version-2.1.md

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* add issue number and link to isnull filter section in release overview

* reoreder issue notes based on alphabetical order

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Added Device Factory (#4825)

* added device factory to generate_test_data command

* 4647.added -> 4647.housekeeping

* unittests

* unittest fixes

* unittest fixes

* Update nautobot/dcim/factory.py

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* change factory boy random_string len

* change ean length

* unittest

* unittests

* unittest

* unittest

* unittest

* address PR feedback

* unittests

* address PR feedback

* undo class order

* undo class order

* address PR feedback

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Created convenience methods to access Git with and without secrets. (#4973)

* Created convenience methods to access Git with and without secrets.

* Updates per feedback

* fix import and update function name

* Update nautobot/extras/datasources/git.py

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>

* UI/UX - Updates to homepage tiles (#4908)

* Add panel toggling

* Change to use cookies. Fixes JS toggling

* Draggable homepage panels

* Make homepage panel loading more seamless

* Fix homepage loading with default order

* Remove code from testing

* Add change file

* Add newline to end of file

* Fix integration tests

* Convert panel collapse from JQuery to JS

* Convert jQuery draggable code to JavaScript

* PR feedback changes

* PR feedback

* Add noscript to show panels with JS disabled

* Update handleDrop functiono

* Standardize on double quotes

* Remove unused function

* Enable dragging only if JS is enabled

* Update nautobot/project-static/js/homepage_layout.js

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Update nautobot/project-static/js/homepage_layout.js

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Add new homepage feature to docs

* Revise release-note

* Add dragend handler

---------

Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Add JSONVar for Jobs (#4927)

* Add JOB_CREATE_FILE_MAX_SIZE setting (#5007)

* Fix #4894 - add JOB_CREATE_FILE_MAX_SIZE setting

* Change fragments

* Changed screenshots in docs to reflect UI changes. (#4958)

* Changed screenshots in docs to reflect UI changes.

* Fix misspelt words

* Add screenshots to docs/index.md, run pngcrush on images

* update docs

* custom fields added

* relationships

* Convert WebP images back to PNG and run pngcrush

* graphql

* pngcrush graphql images

* first batch of getting-started-edits

* update screenshots 33-44 for the ui getting started guide

* Done with getting-started-nautobot-ui

* more screenshot updates

* update screenshots for git as a data source

* Update nautobot/docs/user-guide/platform-functionality/dynamicgroup.md

Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

---------

Co-authored-by: Timizuo <ebideritimizuo@gmail.com>
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>

* Zackt25 update readme gifs for 2.1 (#5003)

* Initial commit

* Test full render and quality

* Test full render and quality

* Add gifs

* Update changes

* Make gif smaller

---------

Co-authored-by: Zack Tobar <zack.tobar@networktocode.com>
Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* External Integration edit form updates (#5008)

* Changed the order and help text of fields in the External Integration create and edit forms.

* Remove redundant code tags

---------

Co-authored-by: Glenn Matthews <glenn.matthews@networktocode.com>

* Fix 4884.changed content

---------

Co-authored-by: itdependsnetworks <ken@celenza.org>
Co-authored-by: Jan Snasel <jan.snasel@networktocode.com>
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>
Co-authored-by: Jathan McCollum <jathan@gmail.com>
Co-authored-by: Hanlin Miao <46973263+HanlinMiao@users.noreply.github.com>
Co-authored-by: Norbert Mieczkowski <norbert.mieczkowski@codilime.com>
Co-authored-by: Timizuo <ebideritimizuo@gmail.com>
Co-authored-by: Norbert Mieczkowski <117445994+norbert-mieczkowski-codilime@users.noreply.github.com>
Co-authored-by: Timizuo <94907097+timizuoebideri1@users.noreply.github.com>
Co-authored-by: matt852 <matt.vitale@networktocode.com>
Co-authored-by: Hanlin Miao <hanlin980505@gmail.com>
Co-authored-by: Jeremy White <jeremy.lee.w@me.com>
Co-authored-by: Zack Tobar <76115401+zackt25@users.noreply.github.com>
Co-authored-by: Zack Tobar <zack.tobar@networktocode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants