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

Get rid of crispy-forms #2794

Open
4 of 53 tasks
Tracked by #2789 ...
hmpf opened this issue Jan 5, 2024 · 5 comments
Open
4 of 53 tasks
Tracked by #2789 ...

Get rid of crispy-forms #2794

hmpf opened this issue Jan 5, 2024 · 5 comments
Assignees
Labels
META I contain multitudes

Comments

@hmpf
Copy link
Contributor

hmpf commented Jan 5, 2024

crispy-forms needs to be upgraded to work with Django 4.2. This is a breeze.

Unfortunately, we also use crispy-forms-foundation, and newer crispy-forms-foundation needs Foundation 6. NAV is written to use Foundation 5.

This means either upgrading Foundation to 6 or replace Foundation 5 with something else or forking crispy-forms-foundation to work with foundation 5.

Rather than follow the house-of-cards-style upgrade path, we should instead look into throwing out crispy-forms entirely and replacing it with form templates in pure Django.

Initial work

Form classes that use crispy-forms FormHelper:

These form classes have been identified as using crispy-forms FormHelper in some way, through Python code. Whether they are rendered using crispy-forms template tags has not been verified.

These could individually be altered into issues and self-assigned, or they could easily be grouped as one issue per file, if so desired.

#2981 can be used as a template, of sorts, that shows in a step-wise fashion how a conversion can be achieved.

nav.web.styleguide

  • python/nav/web/styleguide.py:StyleFormTwo (this is more than just changing it, since the styleguide refers to us using crispyforms, so the content also needs to be changed)

nav.web.alertprofiles

  • Uncrispify AlertProfileForm in alert profiles #2999
  • python/nav/web/alertprofiles/forms.py:AlertAddressForm
  • python/nav/web/alertprofiles/forms.py:TimePeriodForm
  • python/nav/web/alertprofiles/forms.py:AlertSubscriptionForm
  • python/nav/web/alertprofiles/forms.py:FilterGroupForm
  • python/nav/web/alertprofiles/forms.py:FilterForm
  • python/nav/web/alertprofiles/forms.py:MatchFieldForm

nav.web.arnold

  • python/nav/web/arnold/forms.py:JustificationForm
  • python/nav/web/arnold/forms.py:QuarantineVlanForm
  • python/nav/web/arnold/forms.py:SearchForm
  • python/nav/web/arnold/forms.py:DetentionProfileForm
  • python/nav/web/arnold/forms.py:ManualDetentionTargetForm
  • python/nav/web/arnold/forms.py:ManualDetentionForm

nav.web.devicehistory

  • python/nav/web/devicehistory/forms.py:DeviceHistoryViewFilter

nav.web.info

  • python/nav/web/info/forms.py:SearchForm

nav.web.ipdevinfo

  • python/nav/web/ipdevinfo/forms.py:SearchForm
  • python/nav/web/ipdevinfo/forms.py:ActivityIntervalForm
  • python/nav/web/ipdevinfo/forms.py:BooleanSensorForm

nav.web.l2trace

  • python/nav/web/l2trace/forms.py:L2TraceForm

nav.web.macwatch

  • python/nav/web/macwatch/forms.py:MacWatchForm

nav.web.maintenance

  • python/nav/web/maintenance/forms.py:MaintenanceTaskForm

nav.web.messages

  • python/nav/web/messages/forms.py:MessageForm

nav.web.navlets

  • python/nav/web/navlets/forms.py:AlertWidgetForm

nav.web.portadmin

  • python/nav/web/portadmin/forms.py:SearchForm

nav.web.radius

  • python/nav/web/radius/forms.py:ErrorLogSearchForm
  • python/nav/web/radius/forms.py:AccountLogSearchForm
  • python/nav/web/radius/forms.py:AccountChartsForm

nav.web.seeddb.forms

nav.web.seeddb.page.vlan

  • python/nav/web/seeddb/page/vlan.py:VlanFilterForm

nav.web.seeddb.page.management_profile

  • python/nav/web/seeddb/page/management_profile/forms.py:ManagementProfileFilterForm

nav.web.seeddb.page.netbox

  • python/nav/web/seeddb/page/netbox/forms.py:NetboxModelForm
  • python/nav/web/seeddb/page/netbox/forms.py:NetboxFilterForm

nav.web.sortedstats

  • python/nav/web/sortedstats/forms.py:ViewForm

nav.web.status2

  • python/nav/web/status2/forms.py:StatusPanelForm
  • python/nav/web/status2/forms.py:StatusWidgetForm

nav.web.syslogger

  • python/nav/web/syslogger/forms.py:LoggerGroupSearchForm

nav.web.threshold

  • python/nav/web/threshold/forms.py:ThresholdForm

nav.web.useradmin

  • python/nav/web/useradmin/forms.py:AccountGroupForm
  • python/nav/web/useradmin/forms.py:AccountForm
  • python/nav/web/useradmin/forms.py:PrivilegeForm
  • python/nav/web/useradmin/forms.py:OrganizationAddForm
  • python/nav/web/useradmin/forms.py:GroupAddForm
  • python/nav/web/useradmin/forms.py:AccountAddForm
  • python/nav/web/useradmin/forms.py:TokenForm

nav.web.webfront

  • python/nav/web/webfront/forms.py:LoginForm
  • python/nav/web/webfront/forms.py:NavbarlinkForm
  • python/nav/web/webfront/forms.py:ChangePasswordForm
  • python/nav/web/webfront/forms.py:ColumnsForm

Forms that are otherwise rendered through crispy-forms template tags

None have been identified thus far (but their existence cannot be precluded)

@hmpf hmpf mentioned this issue Jan 5, 2024
2 tasks
@hmpf hmpf changed the title Upgrade crispy-forms (This means either upgrading Foundation to 6 or replace Foundation 5 or forking crispy-forms-foundation to work with foundation 5.) Upgrade crispy-forms Jan 5, 2024
@hmpf
Copy link
Contributor Author

hmpf commented Mar 1, 2024

There exists no official guide to upgrading from Foundation 5 to 6. Here's an unofficial one from 2016: Updating to Zurb Foundation 6, not.

@hmpf
Copy link
Contributor Author

hmpf commented Mar 1, 2024

If it is only the forms that use Foundation, we could just switch to a different theme in crispy-forms. We need to find out where and how Foundation is being used.

@hmpf
Copy link
Contributor Author

hmpf commented Mar 1, 2024

Direct use in python:

python/nav/web/radius/forms.py:24:from crispy_forms_foundation.layout import Layout, Row, Column, Submit
python/nav/web/navlets/forms.py:6:from crispy_forms_foundation import layout
python/nav/web/devicehistory/forms.py:23:from crispy_forms_foundation.layout import Layout, Fieldset, Row, Column, Field
python/nav/web/messages/forms.py:20:from crispy_forms_foundation.layout import Submit
python/nav/web/l2trace/forms.py:18:from crispy_forms_foundation.layout import Layout, Row, Column, Submit, Field
python/nav/web/threshold/forms.py:21:from crispy_forms_foundation.layout import Layout, Fieldset, Submit, Row, Column
python/nav/web/crispyforms.py:20:from crispy_forms_foundation.layout import Field, Submit, Button
python/nav/web/ipdevinfo/forms.py:20:from crispy_forms_foundation.layout import Layout, Row, Column, Field, Submit
python/nav/web/styleguide.py:21:from crispy_forms_foundation.layout import Layout, Column, Row, Fieldset
python/nav/web/maintenance/forms.py:20:from crispy_forms_foundation.layout import Layout, Row, Column, Field
python/nav/web/alertprofiles/forms.py:27:from crispy_forms_foundation.layout import Layout, Row, Column, Field, Submit, HTML
python/nav/web/arnold/forms.py:22:from crispy_forms_foundation.layout import Layout, Fieldset, Div, Row, Submit, Column
python/nav/web/status2/forms.py:24:from crispy_forms_foundation.layout import (
python/nav/web/syslogger/forms.py:7:from crispy_forms_foundation.layout import Layout, Fieldset, Row, Column, Field
python/nav/web/useradmin/forms.py:25:from crispy_forms_foundation.layout import (
python/nav/web/templates/foundation-5/README.txt:1:Place templates for globally overriding crispy_forms_foundation templates in this directory.
python/nav/web/portadmin/forms.py:20:from crispy_forms_foundation.layout import Layout, Row, Column, Submit
python/nav/web/info/forms.py:21:from crispy_forms_foundation.layout import Layout, Row, Column, Submit, Field
python/nav/web/webfront/forms.py:22:from crispy_forms_foundation.layout import Layout, Fieldset, Row, Column, HTML, Submit
python/nav/web/sortedstats/forms.py:21:from crispy_forms_foundation.layout import Layout, Fieldset, Row, Column
python/nav/web/seeddb/page/netbox/forms.py:23:from crispy_forms_foundation.layout import (
python/nav/web/seeddb/page/vlan.py:22:from crispy_forms_foundation.layout import Layout, Row, Column, Fieldset
python/nav/web/seeddb/forms/__init__.py:25:from crispy_forms_foundation.layout import Layout, Field, Fieldset, Row, Column

@hmpf
Copy link
Contributor Author

hmpf commented Mar 1, 2024

Usage in javascript. Number is count of times foundation is mentioned in the file, comments excluded.

5 python/nav/web/static/js/src/info_room_rack.js
4 python/nav/web/static/js/src/seeddb_add_patch.js
4 python/nav/web/static/js/src/plugins/delegate_tooltip.js
4 python/nav/web/static/js/libs/foundation.min.js
3 python/nav/web/static/js/src/subnetmatrix.js
3 python/nav/web/static/js/src/portadmin.js
3 python/nav/web/static/js/src/plugins/navlet_controller.js
3 python/nav/web/static/js/src/devicehistory.js
2 python/nav/web/static/js/src/seeddb.js
2 python/nav/web/static/js/src/main.js
2 python/nav/web/static/js/src/ipam/views/subnetallocator.js
2 python/nav/web/static/js/src/info_room.js
2 python/nav/web/static/js/libs/datatables.min.js
1 python/nav/web/static/js/src/webfront.js
1 python/nav/web/static/js/src/threshold.js
1 python/nav/web/static/js/src/status2/views.js
1 python/nav/web/static/js/src/radius.js
1 python/nav/web/static/js/src/plugins/navlets_controller.js
1 python/nav/web/static/js/src/netmap/control_view.js
1 python/nav/web/static/js/src/ipam/app.js
1 python/nav/web/static/js/require_config.js

Noe that the datatables we use seems to depend on Foundation as well.

@hmpf
Copy link
Contributor Author

hmpf commented Mar 1, 2024

Usage in html, {% load crispy_forms_tags%} and {% load crispy_forms_fields %} excluded. Number is count of times crispy is mentioned in the file.

3 python/nav/web/templates/webfront/preferences.html
3 python/nav/web/templates/useradmin/group_detail.html
3 python/nav/web/templates/useradmin/account_detail.html
2 python/nav/web/templates/seeddb/service_property_form.html
2 python/nav/web/templates/seeddb/management-profile/edit.html
2 python/nav/web/templates/seeddb/list.html
2 python/nav/web/templates/seeddb/edit_prefix.html
2 python/nav/web/templates/seeddb/edit_device_group.html
2 python/nav/web/templates/seeddb/edit.html
2 python/nav/web/templates/foundation-5/field.html
2 python/nav/web/templates/custom_crispy_templates/field_helptext_as_icon.html
1 python/nav/web/templates/webfront/login.html
1 python/nav/web/templates/useradmin/userinfo.html
1 python/nav/web/templates/useradmin/token_edit.html
1 python/nav/web/templates/threshold/set_threshold.html
1 python/nav/web/templates/syslogger/frag-search.html
1 python/nav/web/templates/status2/status.html
1 python/nav/web/templates/sortedstats/sortedstats.html
1 python/nav/web/templates/seeddb/service_netbox_form.html
1 python/nav/web/templates/seeddb/netbox_wizard.html
1 python/nav/web/templates/seeddb/edit_vlan.html
1 python/nav/web/templates/radius/error_log.html
1 python/nav/web/templates/radius/account_log.html
1 python/nav/web/templates/radius/account_charts.html
1 python/nav/web/templates/portadmin/base.html
1 python/nav/web/templates/navlets/status2_edit.html
1 python/nav/web/templates/navlets/room_map_view.html
1 python/nav/web/templates/navlets/room_location_status_edit.html
1 python/nav/web/templates/navlets/portadmin_view.html
1 python/nav/web/templates/navlets/graph_edit.html
1 python/nav/web/templates/navlets/alert_edit.html
1 python/nav/web/templates/messages/save.html
1 python/nav/web/templates/maintenance/new_task.html
1 python/nav/web/templates/macwatch/addmacwatch.html
1 python/nav/web/templates/l2trace/l2trace.html
1 python/nav/web/templates/ipdevinfo/sensor-details.html
1 python/nav/web/templates/ipdevinfo/search.html
1 python/nav/web/templates/ipdevinfo/modules.html
1 python/nav/web/templates/info/vlan/base.html
1 python/nav/web/templates/info/room/base.html
1 python/nav/web/templates/info/prefix/base.html
1 python/nav/web/templates/info/netboxgroup/list_groups.html
1 python/nav/web/templates/info/location/base.html
1 python/nav/web/templates/info/base.html
1 python/nav/web/templates/devicehistory/history_view.html
1 python/nav/web/templates/devicehistory/history_search.html
1 python/nav/web/templates/custom_crispy_templates/horizontal_checkbox.html
1 python/nav/web/templates/arnold/search.html
1 python/nav/web/templates/arnold/quarantinevlans.html
1 python/nav/web/templates/arnold/manualdetain.html
1 python/nav/web/templates/arnold/manualdetain-step2.html
1 python/nav/web/templates/arnold/justifications.html
1 python/nav/web/templates/arnold/edit_detention_profile.html
1 python/nav/web/templates/alertprofiles/timeperiod_form.html
1 python/nav/web/templates/alertprofiles/timeperiod_edit.html
1 python/nav/web/templates/alertprofiles/subscription_form.html
1 python/nav/web/templates/alertprofiles/base_detail.html

@lunkwill42 lunkwill42 changed the title Upgrade crispy-forms Get rid of crispy-forms Sep 16, 2024
@lunkwill42 lunkwill42 self-assigned this Sep 16, 2024
@lunkwill42 lunkwill42 added the META I contain multitudes label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
META I contain multitudes
Projects
None yet
Development

No branches or pull requests

2 participants