Posts by Thomas Caio • 92 points
13 posts
-
0
votes1
answer87
viewsQ: Python rest_framework how to change URL?
How can I change the urls in rest_framework on Django? The router defaults to using the creature ID in the URL ex. /api/Creatures/1/ I want instead of appearing the ID, appear the name of the…
-
-2
votes2
answers183
viewsQ: Footer at the end of the template after scroll
Hello I would like to organize the pages of a project so that the footer always appears after the page scrolls down. As you can see, the footer is appearing at the bottom of the template. I managed…
-
0
votes0
answers38
viewsQ: Django form that varies according to another form
How do I create a form in Jango of an object and that the price of the object varies according to the size of the object without having to update the page. #py.models class Pizza(models.Model):…
-
1
votes1
answer149
viewsQ: Foreignkey error with Sqlalchemy
Basically what I want is for him to register in Transaction() the Account he sends and the Account he receives the amount. However I am not able to link the two Foreign key with the accounts I am…
-
0
votes1
answer44
viewsQ: Unintentionally changing the value of the object
Project link: https://github.com/ThomasCaio/RPG2 self.enemy.Damage returns : {'Physical': 45, 'fire': 25} self.Defense returns : {'Physical': 50} def receive_damage(self): damage = self.enemy.damage…
-
0
votes1
answer267
viewsQ: Serialize Python Objects in JSON
Does anyone know how to serialize in YAML or JSON a class that contains attributes that contain other classes? Class player has the Spellbook attribute (class that returns a magic list) and the…
-
-1
votes1
answer40
viewsQ: Function that returns a new instance of a class
Can anyone explain to me why this function is not returning a new instance. It returns a monster object exactly as I want, but when the monster dies, the new instance it returns comes back exactly…
-
3
votes2
answers312
viewsQ: Optimizing Imports in python
I have a folder that contains several files with the extension. py and inside each file has a dictionary with the data of the monsters that I need to start. However, the more monsters I create, the…
-
0
votes1
answer19
viewsA: python3 Tkinter flaw in the allocation of butons
The variable you are using to create a button has the same name as the function. The Button parameter is "command". button = Button(frame,text='login',command=self.login) button.pack()…
-
1
votes1
answer851
viewsQ: Python pandas formatting
import numpy as np import pandas as pd ID = [i for i in range(1,101)] def tabela(imc): if imc < 18.5: return 'Abaixo do peso' elif imc < 25 and imc >= 18.5: return 'Saudável' elif imc <…
-
0
votes1
answer187
viewsQ: Finishing a python project
I have some questions about the projects created in python. If I create a program and need to pass it to someone else, I will need the other computer to have python installed and with all the libs I…
-
0
votes1
answer822
viewsQ: Python CSV How to rewrite only one line of the file?
I have a row that stores within the file the following columns: ID Nome Telefone Descrição DataEntrada HoraEntrada The ID is basically the line number and it is through it that I will seek to know…
-
0
votes1
answer34
viewsQ: I’m having trouble printing database values
I am trying to print the 'ok' on the screen when it finds the value '3' inside one of the Keys of the database. >>> with dbm.open('data1.db','r') as user: user['0'] = '1' user['1'] = '2'…
python-3.xasked Thomas Caio 92