I do not understand what the employer wants, how to implement fronted through the api?

I apologize in advance for the obvious question, but time is running out. In the terms of reference stated:

"The app every N minutes and requests a list of vacancies, which gives the service A and stores the field id
title , state , owner for new vacancies. If the object is a job already exists in the application database, then
you must synchronize the status. If the resulting list is missing the previously synchronized
vacancy, its status is changed to ARCHIVE .
The application has an API through which the front-end gets a list of timed jobs
with the ability to filter by status and owner. By default, displays a list
synchronized jobs with all statuses, except ARCHIVE . The list of archived jobs can
see applying a filter. Update the displayed list without reloading the page."

Exactly how data is output to the front through the api? Here is my rest5e2910ae87527275391386.png
Do I understand correctly that I don't need to render the html template? How, then, to run the front? A cursory examination of the search yielded nothing. Thank you
April 4th 20 at 13:26
2 answers
April 4th 20 at 13:28
Solution
Understand correctly, render the html template is not necessary. You need a web server to give a static front with the root URL, and the javascript code of this front will pull endpointy your API.
It is not entirely clear, I send this representation of the data
class FirstappView(APIView):
 def get(self, request):
 profiles = Profile.objects.all()
 serializer = FirstappSerializer(profiles, many=True)
 return Response({"profile": serializer.data})

I need to send a different html view, where? When you request for a url will be derived page?
mapping includes = [
 path('admin/', admin.site.urls),
 path('api/', include('firstapp.urls')),
]
- elbert.Eichmann commented on April 4th 20 at 13:31
@elbert.Eichmannand? - Elody37 commented on April 4th 20 at 13:34
You have a frontend on what is actually written? - Elody37 commented on April 4th 20 at 13:37
I think write in HTML, CSS and JavaScript. I understand that ajax is the right alternative rendering? - elbert.Eichmann commented on April 4th 20 at 13:40
@elbert.Eichmann, Ajax do not like either connected with rendering.
you can Ajax to raw data (and render them on the client) and ready to render and paste where you want. - Alec41 commented on April 4th 20 at 13:43
@Alec41, Which of these options do I need? - elbert.Eichmann commented on April 4th 20 at 13:46
@elbert.Eichmann, ajax is one of the ways of interaction of fronted and backend. The frontend may be different degrees of development, from complete absence, to fat client, performing the part of the application logic. Accordingly, the rendering of django templates may or may not be used at all or used in conjunction with the rendering on the front. - Elody37 commented on April 4th 20 at 13:49
@elbert.Eichmannwhat is needed - it should be visible to you, in accordance with a specific task in the TOR. There is a suspicion that the customer expects from you, which the frontend will use any framework - Angular, React, Vue. - Elody37 commented on April 4th 20 at 13:52
@elbert.Eichmann, both of you.
the first query spits out a fully finished page.
on subsequent requests to the same page (filters different tabs, and all that), load the data and render on the front. - Alec41 commented on April 4th 20 at 13:55
@Elody37, thanks for the help. Just give the answer, I don't need to do return render()
in the view , you need to do return Response({"profile": serializer.data}) to the url /static or what? - elbert.Eichmann commented on April 4th 20 at 13:58
@Alec41Spit out json? Using what function? - elbert.Eichmann commented on April 4th 20 at 14:01
@elbert.Eichmann, judging by the screenshot you used DRF. It is very declarative, in most cases, including yours, don't need it any functions. - Elody37 commented on April 4th 20 at 14:04
@elbert.Eichmann, suggest how to bring JSON? o_o
are you sure you want to do web dev? - Alec41 commented on April 4th 20 at 14:07
@Elody37, this means the user will interact with drf wanderer at api/firstapp, it will be up front with forms and stuff? - elbert.Eichmann commented on April 4th 20 at 14:10
@Alec41, stilnenko of course, but I know what a json. I do not understand on a practical, fundamental level. How to display the page without the function return render in views that perform when you request the url? - elbert.Eichmann commented on April 4th 20 at 14:13
@elbert.Eichmann, I am extremely glad that you can resist malicious criticism. believe me, this is a huge plus in the development on this path.

and now in fact: you must have the entity (class, object, stupid bunch of unclear code), which you return. then you transform these data into ready HTML using the render template (the first request) or give Johns ohms, when requested through API. - Alec41 commented on April 4th 20 at 14:16
@Alec41, thank you, this is it. - elbert.Eichmann commented on April 4th 20 at 14:19
@elbert.Eichmann, the user opens http://127.0.0.1:8000, a web server or django project gives him an html page, the browser loads along with the whole static - images, styles and js-scripts, run scripts, refer to 127.0.0.1:8000/api/firstapp, django project gives data in json format, the browser downloads it, the script analyzes this data and modifies the html page in accordance with the result of the analysis. - Elody37 commented on April 4th 20 at 14:22
@Elody37, all right. except that the first request is given to the finished page. - Alec41 commented on April 4th 20 at 14:25
@Elody37, * conditionally ready.
the page is blank, but all the data for the renderer's in it. - Alec41 commented on April 4th 20 at 14:28
@Alec41, I agree with the approach, just trying to explain simply, without details. - Elody37 commented on April 4th 20 at 14:31
April 4th 20 at 13:30
Meaning that data is loaded via AJAX using parameters for filtering. The template contains the skeleton of the village with an empty data block and the necessary scripts.
the template on the first request can be (and should be) filled on the server. - Alec41 commented on April 4th 20 at 13:33
But if I say that you need to perform tasks at raspisany to use celery, something changes? - elbert.Eichmann commented on April 4th 20 at 13:36
@elbert.Eichmann, nothing changes, as Celery to this question at all has no relation. - Elody37 commented on April 4th 20 at 13:39

Find more questions by tags DjangoDjango Rest Framework