I think default settings similar to these below would give the best result,
the hardware ID field id is disabled and not shown by default but it's
required if enabled and that can be changed if needed:

HARDWARE_ID_ENABLED = getattr(settings,
'DJANGO_NETJSONCONFIG_HARDWARE_ID_ENABLED', False)
# defaults
HARDWARE_ID_OPTIONS = {
    'blank': not HARDWARE_ID_ENABLED,
    'label': _('serial number'),
    'help_text': _('some helpful text here'),
    'maxlength': 32
}
HARDWARE_ID_OPTIONS.update(getattr(settings,
'DJANGO_NETJSONCONFIG_HARDWARE_ID_OPTIONS', {}))

# model field then is initialized like:
hardware_id = CharField(**HARDWARE_ID_OPTIONS)

On Thu, Oct 4, 2018 at 9:59 AM Oliver Kraitschy <[email protected]> wrote:

> On Tue, Oct 02, 2018 at 01:45:14AM -0700, Federico Capoano wrote:
>
> >     So what about 3 new django settings:
> >
> >     - enable hardware_id field
> >
> > So we should assume that if it's enabled it will also be required?
>
> I wasn't thinking about that distinction. If it isn't required in any
> case, it could be enabled by default which means that the setting is about
> wether is is required or not, not enabled or not - the user (or
> openwisp-config) is free to provide a value but he doesn't need to provide
> a value.
>
> What do you think?
>
> > I'd start with creating issues by summarizing what we discussed here on
> > github.
>
> Thank you for creating the issues!
>
> Greetings,
> Oliver
>
> --
> You received this message because you are subscribed to the Google Groups
> "OpenWISP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to