Hello Amit,

did the openwisp-controller restart without any errors? and is the normal
flow of adding new devices working without any errors? if they are, then it
should work.
please ensure the method is in the class and that openwisp-controller
restarts with the added changes.

On Wed, Sep 4, 2019 at 8:52 AM Amit Goyal <amitgoya...@gmail.com> wrote:

> Hi Noumbissi
>
> Thanks for your help.
>
>
> I have updated * /usr/src/app/openwisp_controller/config/admin.py*  inside
> openwisp container as below but changes are not reflecting on UI side even
> after openwisp restart.
>
> //Added template_field in DeviceAdmin
>
> class DeviceAdmin(MultitenantAdminMixin, AbstractDeviceAdmin):
>     inlines = [ConfigInline]
>     list_filter = [('organization', MultitenantOrgFilter),
>                    'config__backend',
>                    ('config__templates', MultitenantRelatedOrgFilter),
>                    'config__status',
>                    'created','*template_field*']
>
> //add it to list_display
>
>  def template_field(self, obj):
>         template_names = []
>         if obj:
>             config = Config.objects.get(device=obj)
>             templates = config.templates.all()
>             for template in templates:
>                 template_names.append(template.name)
>             return ",".join(template_names)
>         return
>
>     template_field.short_description = "Templates"
>
> DeviceAdmin.list_display.append('template_field')
>
>
> Please let me know what need to be done to get it displayed at UI side .
>
>
>
> On Thursday, August 29, 2019 at 4:11:39 PM UTC+5:30, Noumbissi Valere
> wrote:
>>
>> Hello Amit,
>>
>> The relationship between Device and Template is found in the Config model.
>> You can add a custom  modelAdmin field to the DeviceAdmin found in
>> openwisp_controller.config.admin.py file.
>> once you've created your custom field, you can then add it to the
>> list_display by appending it to the DeviceAdmin.list_display.
>> something like this,
>>
>> def template_field(self, obj):
>> template_names = []
>> if obj:
>> config = Config.objects.get(device=obj)
>> templates = config.templates.all()
>> for template in templates:
>> template_names.append(template.name)
>> return ",".join(template_names)
>> return
>>
>> template_field.short_description = "Templates"
>>
>> DeviceAdmin.list_display.append('template_field')
>>
>> to achieve something like this,
>>
>>
>>
>> On Thu, Aug 29, 2019 at 10:19 AM Amit Goyal <amitg...@gmail.com> wrote:
>>
>>> Hi Openwisp Team
>>>
>>> I am very new to Django Frame work and don't know complete details of
>>> openwisp django frame work.
>>>
>>> I need to add one more field in device table of Openwisp UI .
>>>
>>> New Field-: Template linked to Device
>>> Changes expecting -:
>>> 1-: Query fetching device table information
>>> 2-: UI change to display new field template in device table
>>>
>>> Can someone let me know where all I need to make change in
>>> openwisp-controller 3.2 to implement this requirement
>>>
>>> Device Table-: Template new field to be added.
>>>
>>>
>>> [image: openwisp.jpg]
>>>
>>> --
>>> 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 open...@googlegroups.com.
>>> To view this discussion on the web, visit
>>> https://groups.google.com/d/msgid/openwisp/6b65dae6-cc82-4c78-a296-16388097bd55%40googlegroups.com
>>> <https://groups.google.com/d/msgid/openwisp/6b65dae6-cc82-4c78-a296-16388097bd55%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 openwisp+unsubscr...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/openwisp/07d8e449-1445-4aeb-89f9-1bcac3e2e2ee%40googlegroups.com
> <https://groups.google.com/d/msgid/openwisp/07d8e449-1445-4aeb-89f9-1bcac3e2e2ee%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 openwisp+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/openwisp/CAOwnGe4zvmUyapz07m5noOeT3H83y06-S7szMbUCR5uYhhb11w%40mail.gmail.com.

Reply via email to