networks: Fix issue with loading create PPPoE form

- The form does not have DNS-over-TLS field and trying to set initial value for
it fails.

Tests:

- Load the PPPoE creation form. Without the patch, it fails with an exception.
With the patch it succeeds.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2024-11-13 15:39:34 -08:00 committed by Veiko Aasa
parent c1a8607d85
commit b465c33e1b
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -168,8 +168,9 @@ class ConnectionForm(forms.Form):
"""Disable DNS fallback field if necessary."""
from plinth.modules import names
super().__init__(*args, **kwargs)
self.fields['dns_over_tls'].disabled = (
not names.is_resolved_installed())
if 'dns_over_tls' in self.fields:
self.fields['dns_over_tls'].disabled = (
not names.is_resolved_installed())
@staticmethod
def _get_interface_choices(device_type):