Posts by Rubens Rafael • 39 points
10 posts
-
0
votes1
answer23
viewsA: show value instead of foreign key DJANGO API
To get information from another model, you can nest the serializers. Nesting serializers is easier than it looks. Let me give you a general example, and you can go deeper in that documentation.…
-
0
votes2
answers69
viewsA: Compare arrays or strings and return an array with all repeated elements (javascript)
In a general solution, to find the repeated items, you can turn this multidimensional array into a single array, since in this case (to find the repeated ones) the dimensions don’t matter. let…
-
0
votes1
answer26
viewsA: Create serialization with data from two tables
Nesting serializers is easier than it looks. I’ll give you a general example, and you can delve deeper in that documentation. Nesting is when you have a model, which has to be "called", in the…
-
-1
votes1
answer54
viewsA: How to create a button to change a text in my html with data coming from Django’s models.py?
When you send the context to Django’s front-end, it happens only once. To get all the phrases, you could loop the template and put each phrase into an html element (div, p, or whatever you want),…
-
0
votes2
answers50
viewsA: Take a string snippet between two characters
If you are sure that this information always comes this way, you can use the split method. texto = '<http://informacaoquepreciso.com.br> "rel"="next"' parte_util = texto.split('>')[0][1:]]…
-
0
votes2
answers15
viewsA: DRF/Django - How to send an attribute value instead of sending a JSON object
You can try to modify the behavior of your serializer. As you say that one documentation. You specify the return __str__ of its related objects, and will retrieve only that information. When…
-
0
votes1
answer21
viewsA: How to pass "invisible" variables from one page to another using a link in Django?
You can make a POST, and send the data to the other view. It does the query set and returns a response, but as you sent it by POST, the identifiers will not appear in the url. But you have to be…
-
1
votes1
answer51
viewsA: Perform the action of a form without updating the page on Django
Using AJAX you can easily, but for this we will use a special tool, and configure it the right way. First you need to install the Xios. It is an http client that can be added to your html by the…
-
0
votes2
answers1083
viewsA: Passes template content to view Django
Using AJAX you can easily, but for this we will use a special tool, and configure it the right way. First you need to install the Xios. It is an http client that can be added to your html by the…
djangoanswered Rubens Rafael 39 -
0
votes2
answers89
viewsA: What is the best way to select a text and how to store it in a variable?
If that text is in a kind of textbox, where the cursor looks like the Roman number 1, you can click in this area and use the CTRL+A (select all), then copy with the CTRL+C.…