-
Notifications
You must be signed in to change notification settings - Fork 58
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
Unable to save settings when SOTAGG enabled #856
Comments
This is as intended, I understand your point on the user experience of it, though I am not sure the juice is worth the squeeze, and you will see this pattern throughout Nautobot, as shown in this example below. In general, in forms.py, when you inherit from
|
The current documentation asks you to hit save before even touching the
jinja template settings. That step is impossible to do because the form
throws an error if you leave the template section blank (which the
documentation doesnt get to until later).
…On Thu, Jan 2, 2025 at 17:50 Ken Celenza ***@***.***> wrote:
I'm unable to save because the clean method on the model will not allow
you to post an empty sot_agg_query field if the ENABLE_SOTAGG is enabled
This is as intended, I understand your point on the user experience of it,
though I am not sure the juice is worth the squeeze, and you will see this
pattern throughout Nautobot, as shown in this example below.
image.png (view on web)
<https://github.com/user-attachments/assets/32045389-e4ab-4eef-8b0e-6fec9112c48d>
In general, in forms.py, when you inherit from NautobotModelForm it will
introspect the model and update accordingly, however, it does not account
for logic within the clean method of the model, as that can be anything. I
see it as we can:
1. Modify the widget attrs in the init method as shown here:
https://github.com/nautobot/nautobot/blob/8052fe6749e98ff81f678f85402b349e67543a97/nautobot/extras/forms/forms.py#L235
with some complex logic
2. Ping @glennmatthews <https://github.com/glennmatthews> if there is
another option
3. Do nothing, as it works as intended and uses established patterns.
—
Reply to this email directly, view it on GitHub
<#856 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANF3PY5W2UOSZJOHM2QQPT2IXUHZAVCNFSM6AAAAABUQ3ALFGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRYGU4TSMBWGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
got it, fixed in #857 |
Environment
bda93e16e0434edc0a603bc106af1cb49d8cd5c6
Expected Behavior
Following the user guide, section First Steps with App as a brand-new user who has limited nautobot interaction.
I should be able to add a git repository source and then setup the backup configuration and hit save as instructed in the directions.
Observed Behavior
I'm unable to save because the clean method on the model will not allow you to post an empty
sot_agg_query
field if theENABLE_SOTAGG
is enabled. This is listed as a setting that is enabled in the installation guide configuration to copy/paste and is also enabled in the development environment for this repo.I receive the following error when trying to save:
Which is confusing because the form doesn't high-light it's referring to the "Sot agg query" setting under the
Templates Configuration
which I have not modfiied:Steps to Reproduce
Proposed fix
The error is coming from here. So obviously fix is to modify that
if
statement to also check if thejinja_repository
field is not empty before throwing an error.I would also suggest modifying the form to high-light when that field is missing/required. As a new user with a technical background, it was not immediately obvious to me which field that warning message was talking about it.
The text was updated successfully, but these errors were encountered: