Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Added a read only URL field when the strategy is receive #25

Merged
merged 1 commit into from
May 17, 2017

Conversation

rohithasrk
Copy link
Contributor

@rohithasrk rohithasrk commented May 16, 2017

References #9.This PR has a lot more work to do. As of now, I only followed the instructions given in #9 comments. There is a problem with my understanding of read only fields in django admin. Here are my doubts:

  • The read only field doesn't appear in the admin site as of now. Does a HTML element automatically get created with id = id_<parameter>? This is what I was able to make out checking the code.
  • And regarding the js file similar to uuid.js in django_netjsonconfig, I made some changes accordingly but I'm not so clear about it.

@nemesisdesign Please review and study material suggestions are requested.

@coveralls
Copy link

coveralls commented May 16, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling df3ca92 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@nemesifier
Copy link
Member

@rohithasrk need to add explicit fields declaration when adding extra fields.

Also don't forget to load the static files by specifying the Media class. I've added a bit of CSS to make the input look similar to what we have in OpenWISP2 (uuid).

Please rename post_url to receive_url and use dashes instead of underscores for the name of static files (receive-url.js).

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 209b126 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

1 similar comment
@coveralls
Copy link

coveralls commented May 16, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 209b126 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

coveralls commented May 16, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 02c359d on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@nemesifier
Copy link
Member

nemesifier commented May 16, 2017

Now use django.urls.reverse to get the URL, don't forget to append the key on its querystring

@coveralls
Copy link

coveralls commented May 16, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 46e00ff on rohithasrk:receive-url into 7eb7e87 on netjson:master.

js = [static('netjsongraph/receive-url.js')]

def receive_url(self, obj):
return reverse('receive_topology/', kwargs={'pk': obj.key})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, please use obj.pk and append obj.key as its querystring

@coveralls
Copy link

coveralls commented May 16, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 35629b3 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 624f7d8 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

5 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 624f7d8 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 624f7d8 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 624f7d8 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 624f7d8 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 624f7d8 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def receive_url(self, obj):
return reverse('receive_topology/', kwargs={'pk': obj.key})

receive_url.short_description = "RECEIVE_URL"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a human readable string translated with gettext, eg: _('receive url')

def receive_url(self, obj):
return reverse('receive_topology/', kwargs={'pk': obj.pk}) + obj.key

receive_url.short_description = "RECEIVE_URL"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use a human readable string translated with gettext, eg: _('receive url')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks

js = [static('netjsongraph/receive-url.js')]

def receive_url(self, obj):
return reverse('receive_topology/', kwargs={'pk': obj.pk}) + obj.key
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong again, use:

return '{0}?key={1}'.format(reverse('receive_topology/', kwargs={'pk': obj.pk}), obj.key)

@coveralls
Copy link

coveralls commented May 17, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 01341c4 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

coveralls commented May 17, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling b36ff8e on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

coveralls commented May 17, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 36b68d1 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

coveralls commented May 17, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling c2d98c5 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@coveralls
Copy link

coveralls commented May 17, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 176da56 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@nemesifier nemesifier merged commit c4a56c2 into openwisp:master May 17, 2017
@coveralls
Copy link

coveralls commented May 17, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 508fd84 on rohithasrk:receive-url into 7eb7e87 on netjson:master.

@rohithasrk rohithasrk deleted the receive-url branch May 17, 2017 17:25
@rohithasrk rohithasrk changed the title [WIP] Add a read only URL field when the strategy is receive Added a read only URL field when the strategy is receive May 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants