Sure, once that becomes a field it will be easy to add it to the context
dictionary passed to netjsonconfig
<http://netjsonconfig.openwisp.org/en/latest/general/basics.html#context-configuration-variables>
.

On Tue, Oct 2, 2018 at 10:36 PM Aaron Hamilton <[email protected]>
wrote:

> This sounds like it would work for our needs as well. Could we also have a
> template variable available for the serial number/hardware ID?  This way we
> could use the serial number for RADIUS/LDAP usernames and various other
> things.
>
> On Tue, Oct 2, 2018, 01:45 Federico Capoano <[email protected]>
> wrote:
>
>> On Monday, October 1, 2018 at 5:13:42 PM UTC+2, Oliver Kraitschy wrote:
>>>
>>> On Mon, Oct 01, 2018 at 11:20:16AM +0200, Federico Capoano wrote:
>>>
>>> > The human readable label and the help text of the field should be
>>> configurable,
>>> > by default we could use something like "Serial number", but it can be
>>> modified
>>> > to use a different term depending on the context where it is used.
>>> >
>>> > In my opinion this feature should be deactivated by by default and
>>> shown only
>>> > when a specific setting is turned on.
>>>
>>> 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?
>>
>>
>>> - label text for hardware_id field
>>> - help text for hardware_id field
>>>
>>
>> Yes, it could also be one dictionary, eg:
>>
>> 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)
>>
>> A trick would be needed to make this play well with the migration
>> framework but it's doable.
>>
>>
>>> >   • it should be shown and be editable in the add device page, shown
>>> right
>>> >     before or right after the name field
>>>
>>> How is a new device entry created manually referenced by
>>> openwisp-config?
>>>
>>
>> As usual, don't you think?
>>
>>
>>> With the generated key which must be added to the openwisp-config
>>> configuration? Or is this behaviour supposed to be changing with the
>>> hardware_id field? I guess not.
>>>
>>
>> You're guessing right.
>>
>>
>>> >   • it should be shown and (probably) readonly in change device page,
>>> shown
>>> >     right before or right after the name field
>>>
>>> Yes, I vote for a readonly field after device creation. This elimintates
>>> device manipulation and often the hardware_id is not modifiable anyway.
>>>
>>
>> Great!
>>
>>
>>> I'm fine with all of this so far and could work on this.
>>>
>>>
>> I'd start with creating issues by summarizing what we discussed here on
>> github.
>>
>> Federico
>>
>> --
>> 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.
>

-- 
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