Re: [openwisp] Need to add one more field template information in device table of openwisp UI

2019-09-07 Thread Noumbissi Valere
Hello Reddy,

Your are welcome to OpenWISP.
You can start off by reading our contribution guidelines from here;
http://openwisp.io/docs/developer/contributing.html .
When you are done, you can move on to pick any issue from our
contribution board. This can be found here;
https://github.com/orgs/openwisp/projects/3
Since you are versed with Python, i will advice you to start with the To do
(python & django) section.
If you have any questions, you can post them here or on the gitter channel.

Happy hacking 

On Sat, Sep 7, 2019 at 5:04 PM TAMALAMPUDI VIJAYA KUMAR REDDY (N170066) <
n170...@rguktn.ac.in> wrote:

> Hello sir
> I want to contribute to openwisp i know python but i dont have any
> experience in software development how can i start contributing
>
>
> On Fri, Sep 6, 2019 at 12:04 PM Amit Goyal  wrote:
>
>> Hi
>>
>> For testing purpose ,  I made direct changes in container.
>> In container , following file need to be changed.
>>
>>
>> */usr/local/lib/python3.6/site-packages/openwisp_controller/config/admin.py*
>>
>> On Wednesday, September 4, 2019 at 5:53:16 PM UTC+5:30, 2stacks wrote:
>>>
>>> How did you add the file in the container?   Did you rebuild the
>>> container?
>>>
>>> On Wed, Sep 4, 2019, 3:06 AM Noumbissi Valere 
>>> wrote:
>>>
 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  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 
>> 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 

Re: [openwisp] Need to add one more field template information in device table of openwisp UI

2019-09-07 Thread TAMALAMPUDI VIJAYA KUMAR REDDY (N170066)
Hello sir
I want to contribute to openwisp i know python but i dont have any
experience in software development how can i start contributing


On Fri, Sep 6, 2019 at 12:04 PM Amit Goyal  wrote:

> Hi
>
> For testing purpose ,  I made direct changes in container.
> In container , following file need to be changed.
>
>
> */usr/local/lib/python3.6/site-packages/openwisp_controller/config/admin.py*
>
> On Wednesday, September 4, 2019 at 5:53:16 PM UTC+5:30, 2stacks wrote:
>>
>> How did you add the file in the container?   Did you rebuild the
>> container?
>>
>> On Wed, Sep 4, 2019, 3:06 AM Noumbissi Valere 
>> wrote:
>>
>>> 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  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 
> 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
>> 
>> .
>>
> --
 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/07d8e449-1445-4aeb-89f9-1bcac3e2e2ee%40googlegroups.com