The swagger ui doesn't render the detail fields in Title object, how can i fix this?
Related
I was using django-rest-framework-simplejwt for authentication. Here is my settings.py filesettings.py file
Initially I was trying to get login user by accessing request.user in a view function as shown below and passing access token in headers berear token:
function test
But I wasn't able to get the logged in user. Instead when I tried RetreiveAPIView of rest framework generics, it gave me the user..Here is the code for the same..Using RetreiveAPIView
UserSerializer
Initially I thought that both the request objects are same but it seems that there is some difference.. Can anyone explain me what is the difference between the two?
please show your whole View, not only a test method.
In DRF views you can access a request and request.user as a method parameter which is automatically passed into methods of View Class, not a class property (self.request)
look at drf docs https://www.django-rest-framework.org/api-guide/views/
I'm creating a custom policy and I'm trying to customize the behavior when the policy is loading between different pages. Currently, the behavior is that the screen darkens and some text is displayed that overlaps with the rest of the UI. If possible, I'd like to display some completely different HTML content during loading. So far, I've been unable to affect the loading content in the same way that I've been able to affect the rest of the UI.
I have been able to see that a couple divs do appear during loading with IDs "simplemodal-overlap" and "simplemodal-container", and I've attempted to modify these divs using JQuery in the HTML file I've provided to Azure for the custom policy, but nothing I've done seems to have affected those divs in any way.
Has someone customized the loading UI for a custom policy before and can they give me advice on how I can affect its behavior?
Actually, the div with id: simplemodal-overlap is added/removed from HTML page by B2C dynamically:
So you can't capture it directly via JS code. If you just want to change its CSS display, you can just overwrite it on your custom page, on my side, I just use the code below to change its color to grey:
If you want to do more things on it by JS, you can add an event listener to monitor if a dom node with id simplemodal-overlap has been added into your html body. See code below:
<script>
$('body').on('DOMNodeInserted', function(e) {
if($(e.target).attr('id') == 'simplemodal-overlay'){
$(e.target).css({"background":"green","font-size":"100px"});
$(e.target).html("LOADING !!!!!")
}
});
</script>
Result:
In a NodeJS based project, the Swagger that comes with loopback-component-explorer (version 2.7.0) doesn't show the "Parameters" in the HTML page in which we can provide the required params for the Rest endpoints, regardless the http verb (e.g. GET, POST, PATCH etc). Must the remoteMethod(...) definition follow some Swagger requirements?
Thanks.
I've figured out.
When defining the Loopback remoteMethod(...), the option "http.source" for "accepts" should be set to anything different than "req", "res" and context (e.g "body", "form", "query" and "path").
What AMP extensions can be used to get a response from the server in the form of variable that can be used later, such as in a template or as a parameter to an attribute?
amp-access
The authorization endpoint of amp-access can return "a free-form JSON object":
Here’s a small list of possible ideas for properties that can be returned from the Authorization endpoint:
Metering info: maximum allowed number of views and current number of views.
Whether the Reader is logged in or a subscriber.
A more detailed type of the subscription: basic, premium
Geo: country, region, custom publication region
amp-form
amp-form "allows publishers to render the responses using Extended Templates". The response is expected to be a valid JSON Object. Try the "Hiding input fields after success" demo in the amp-form sample to see it in action.
amp-list
amp-list fetches "content dynamically from a CORS JSON endpoint and renders it using a supplied template". The response must be a JSON object that contains an array property "items".
In addition to {{variable}} substitutions in Mustache templates, you can also use AUTHDATA(variable) elsewhere.
amp-live-list (not quite)
amp-live-list is a "wrapper and minimal UI for content that updates live in the client instance as new content is available in the source document". The page will re-fetch itself, giving the server a change to send new content. If new content is found, AMP will populate a <div items> element with the new (HTML) items. You can't use that as a variable.
It's name doesn't really suggest it, but I think you want AMP-list
https://github.com/ampproject/amphtml/blob/master/extensions/amp-list/amp-list.md
Fetches content dynamically from a CORS JSON endpoint and renders it using a supplied template.
I have a simple HTML page which contains a form (uses GET method), whose action is a portal page containing a JSF portlet. I need to access the parameters passed in to the portal page in my portlet - how can I achieve this?
I have tried to access the parameter code on the view page using following code but the value comes up as null.
java.util.Map requestMap = javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String code = requestMap.get("code");
At some other forum it was suggested that I need to pass the the portlet id as request parameter in order to have the portlet access to passed request parameters. If that is true where/how can I lookup my portlet ID so that portlet has access to request parameters?
I would look into whether the WebSphere implementation of public render parameters supports this. If the ExternalContext request parameter map does not expose these values, you can cast the request to a PortletRequest and make use of the Map<String,String[]> getPublicParameterMap() method.
See my article Passing query parameters to JSR-286 portlets here.
I know this is a supported way to do it. I have seen other articles that claim you can simply cast the PortletRequest to something and get the parameters. This is probably not supported in that it depends on a particular implementation and reference to an internal class name. I recommend the above.