-1
  • I want to call an external service API in the Django admin and display the data.
  • Also, I want to create a form so that taking input from the admin, should able to make a POST to external service.
  • My app does not have any models.

django-admin version 2.2.8

Please, someone, provide a solution stuck from last few days Thank You.

lite_17
  • 3
  • 4
  • Welcome to SO. You may want to read [ask] and edit your question accordingly. Note that "gimme da code" questions are not welcome here, so posting your attempts might be a good idea... – bruno desthuilliers Jan 22 '20 at 18:50

1 Answers1

0

For the first question, regarding the external service, you should use the python requests package. Just pip install requests.

For the second one, when you have a form inside the admin, you can access the form's data using request.POST and then use the aforementioned requests package to do a server-side POST request to your external API.

Lastly, you don't need models. An admin GUI is of its basic nature. In Django, you can replace the admin template for your own by specifying where your template lives. You can follow along with this: How to override and extend basic Django admin templates?

Yoomama
  • 133
  • 8