Questions tagged as 'python-3.x'

1
answer

Modify template name Django

I am generating a view to search for products and I want to modify it to also search for users when the name starts with '@'. Right now I have this view: class BusquedaView(FilterView): model = Producto filterset_class = BusquedaFil...
asked by 16.03.2018 / 17:16
1
answer

KeyPressEvent does not detect key 0

I'm trying to capture the keys I press within QLineEdit , but the keyPressEvent() method does not return any results when I press any number or letter it just seems to react with key_Return : This is the sample code: impo...
asked by 21.03.2018 / 21:24
1
answer

How do I import packages from a subfolder to a folder? In python

Suppose that each folder / package already has its respective init .py If I have this composition: -Carpeta Padre | archivo1.py | | Carpeta Hija | | |archivo2.py | |_____________ | |____________________ I would li...
asked by 15.03.2018 / 21:11
1
answer

get elapsed time in django

I am creating a task in Django where I need to take all the orders and check the creation date to see how much time has elapsed, in case 2 days have passed to execute a code and in case 4 have passed, execute a different one. Right now my mod...
asked by 14.03.2018 / 08:48
1
answer

Error = tuple index out of range ... problem with postgresql and python

I have the following function: def Buscar(self): comando="SELECT * FROM tipo_inversion where id='"+self.palabra.get()+"';" conectar=Base_de_datos.BaseDeDatos() conectar.cursor.execute(comando) #rows= conectar.cursor.fetchall()...
asked by 05.03.2018 / 03:58
1
answer

Delete rows and send text to an item in a QTableWidget

I have a problem trying to send a text to an item in a tablewidget. This is the code I use: from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5 import uic from PyQt5.Qt import * class Principal(Q...
asked by 15.07.2018 / 23:32
1
answer

Add 'alias' columns in a row with Postgresql

nombre nit colum_alias1 colum_alias2 total_alias -------------------------------------------------------------------- nombre1 1 1,500 3,000 ? nombre2 2 2,000 4,...
asked by 05.04.2018 / 23:21
1
answer

Do not insert duplicate data

I'm a bit confused, what would be the best practice to not insert duplicate data in a table, I have the following code. cnn = pyodbc.connect ( 'Driver={SQL Server};Server=**;Database=**;uid=**;pwd=**',autocommit=True ) sqlcmd = ("Select GEOM...
asked by 13.03.2018 / 13:20
1
answer

Print column name as headings with bd postgresql and python

I have the following code of a PostgreSQL table, I need you to print the name of columns as a header, with Tabulate and Python, I only get the numbering of the columns as a header, I do not know why: cur.execute("""select * from admin_eps""")...
asked by 01.03.2018 / 17:29
1
answer

Transparency in Windows PyQt Does Not Work

Good afternoon I want to generate a transparency effect in my main window. But when executing the code the transparency is not executed and only a black background is set: This is my code: import sys from PyQt5.QtWidgets import QMainWindow,...
asked by 07.03.2018 / 21:28