Django swagger special character escape documentation - django

I use django and swagger. I write doc string in my django function like this :
/?first_name__icontains=saeed&age__gte=20.
But swagger show them like this
how can I escape characters like & in django and swagger?
Edit:
My code in docstring of a django view
Result in Swagger

& being rendered as & in code blocks is a bug in Swagger UI 2.x which was fixed in UI 3.3.0:
https://github.com/swagger-api/swagger-ui/issues/2700
You need to update your Swagger UI version.

Related

Where is my "raw data & HTML form" option in django rest api?

Hellow developers,
I started using django rest framework, but I am not able to see raw data/ HTML form options in my post request user interface. My dhango and rest framework versions are latest.
The whole API works fine when I insert the data as json inside the content textarea, but I would like to have another options as well.
Found the answer
using decorators (#api_view) will not generate those ui options,
but using inheritated classes like (APIview) will give you those options.

Deploy both .html embedded form and .bpmn model using rest API

according this article its possible to deploy both bpmn model and its embedded form with camunda API requests. the problem is that I dont want to use curl tools. I need to deploy both .bpmn model and .html form files with statndard camunda API post method .
I’ve ever do this to deploy my .bpmn model with generated forms type. but righ now I want to deploy embedded forms (as a seperate .html file). now, how can i upload both of these files with rest API?
( I know that i should use ‘embedded:deployment:sampleEmbeddedForm.html’ in modeler form key)
In addition, I use postman to test these rest APIs.
I would be very grateful if you could help me.
according to help of a friend that the answer is posted here, its possible by adding a new body parameter, as name as form name.

How to display multiple value parameter in django rest framework swagger?

Versions:
coreapi==2.3.1
Django==1.11.2
django-rest-framework==0.1.0
django-rest-swagger==2.1.2
django-silk==1.0.0
djangorestframework==3.6.3
API endpoint: /search?filter=("pages")?filter=("people")
In my SwaggerSchemaView I have defined the filter field as follows:
coreapi.Field(name="filters", description="=search(query)", location="query", type="array", required=True)
Swagger looks like this:
now when i provide the values in the value box, it results in the api of format:
/search?filter=("pages"),("people")
How can I make swagger respect the format I want that is
/search?filter=("pages")?filter=("people")
What you need is not supported by CoreAPI out of the box. It will be after this issue gets fixed - https://github.com/core-api/python-openapi-codec/issues/25
But it is available in OpenAPI(Swagger) using style and explode params - https://swagger.io/specification/
I would recommend writing your own swagger yaml instead of generating it from DRF as DRF is not aligned with Swagger to be able to extract all the required information from it.

Django REST Framework browsable api filter controls not showing

I followed the docs to add filtering to my API, installed django-filter, django-crispy-forms (added to INSTALLED_APPS) and using filter_backends/filter_fields/search_fields I can use the filtering using query parameters. However, the docs say: "Generic filters can also present themselves as HTML controls in the browsable API" and "the browsable API will present a filtering control for DjangoFilterBackend, like so:". My question is how? I don't see any additional controls for filtering/search. I'm using DRF 3.2.4.
Filters displaying as HTML controls on the browsable API is a feature of Django Rest Framework versions 3.3.0 and above.
http://www.django-rest-framework.org/topics/3.3-announcement/
It is unfortunate that they do not version their documentation.

Duplicate block django 1.3?

I'm using django cms 2.2 and django 1.3. I want to automatically generate meta descriptions based on the first 200 characters of my 'content' block.
How can I do this?
You can probably extend the "get_placeholder_content" method from cms_tags.py in django-cms to get the placeholder content for the current page.
From there, you can parse the content, generate your meta tags and output them to the context.