Views

class markdownx.views.ImageUploadView(**kwargs)

Handling requests for uploading images.

form_class

alias of ImageForm

form_invalid(form)

Handling of invalid form events.

Parameters:form (django.forms.Form) – Django form instance.
Returns:JSON response with the HTTP-400 error message for AJAX requests and the default response for HTTP requests.
Return type:django.http.JsonResponse, django.http.HttpResponse
form_valid(form)

If the form is valid, the contents are saved.

If the POST request is AJAX (image uploads), a JSON response will be produced containing the Markdown encoded image insertion tag with the URL using which the uploaded image may be accessed.

JSON response would be as follows:

{ image_code: "![](/media/image_directory/123-4e6-ga3.png)" }
Parameters:form (django.forms.Form) – Django form instance.
Returns:JSON encoded Markdown tag for AJAX requests, and an appropriate response for HTTP requests.
Return type:django.http.JsonResponse, django.http.HttpResponse
class markdownx.views.MarkdownifyView(**kwargs)

Conversion of Markdown to HTML.

post(request, *args, **kwargs)

Handling of the conversion from Markdown to HTML using the conversion function in settings under MARKDOWNX_MARKDOWNIFY_FUNCTION.

Parameters:
  • request – HTTP request.
  • args – Default Django POST arguments.
  • kwargs – Default Django POST keyword arguments.
Returns:

HTTP response

Return type:

django.http.HttpResponse