This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Minhas tabelas relacionadas: | |
class Produto(BaseModel): | |
cdchamada = CharField(null=True, unique=True) | |
dsdescricaoecommerce = TextField(null=True) | |
dsobservacao = TextField(null=True) | |
idproduto = CharField(primary_key=True, null=False) | |
nmproduto = CharField(index=True, null=True) | |
stativo = CharField(null=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TelaSingUp(Screen): | |
dialog = None | |
def show_alert_dialog(self, singin_message): | |
if not self.dialog: | |
self.dialog = MDDialog( | |
text=singin_message, | |
buttons=[ | |
MDFlatButton( | |
text="FECHAR", on_release=self.close_dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''MY main.py''' | |
import json | |
import unicodedata | |
import string | |
from kivy.lang import Builder | |
from kivy.core.window import Window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProductsDataTableScreen(Screen): | |
def on_kv_post(self, base_widget): | |
p = Produto.select(Produto.cdchamada, | |
Produto.nmproduto, | |
Produto.stativo, | |
Produto.cdipi, | |
Produto.cest) | |
# .where(Produto.cdchamada.in_(['000003', '000005','000012'])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Olá gente, | |
O texto vai ficar parecido com o post anterior mas a dúvida é outra! | |
O que me leva a fazer este post é que estou muito empolgado aprendendo a usar Python com Firebase. | |
Estou conseguindo fazer todas as operações de banco de dados se eu trabalhar apenas com um registro (Faço CRUD sem problema nenhum) | |
Então surgiu a necessidade de fazer inserções em massa, eu poderia usar um create dentro de um for mas isso não é aconselhável segundo a documentação do Firebase. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def exporta_produtos_json(self): | |
cred = credentials.Certificate('firebase-sdk.json') | |
default_app = firebase_admin.initialize_app(cred, { | |
'databaseURL': 'https://inventarioshop-8318f-default-rtdb.firebaseio.com/' | |
}) | |
q = Produto.select(Produto.cdchamada, | |
Produto.nmproduto, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.lang import Builder | |
from kivy.core.window import Window | |
from kivy.properties import ObjectProperty | |
from kivy.properties import StringProperty | |
from kivy.network.urlrequest import UrlRequest | |
from kivy.uix.screenmanager import Screen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Fala galera, A live de peewee foi top, aprendi coisa pra caramba, então fui aplicar juntos o peewee + KivyMD. | |
Estou tentando construir uma lista com uma imagem al lado usando TwoLineIconListItem do KivyMD. | |
Antes de falar meu problema fiquem sabendo que consegui fazer essa lista pegando dados de requests, acredito | |
sinceramente que meu problema é o momento de adicionar os widgets, mas vamos prosseguir: | |
Abaixo estão os códigos main.py e main.kv separados, quando eu rodo o código recebo o retorno gigante do Traceback | |
que vou colar no fim desse código. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Criando as classes com PeeWee | |
#Conectando ao PostgreSQL | |
python -m pwiz -e postgresql -u postgres -s wshop -P 5432 ALTERDATA_WSHOP | |
# Classes do Shop | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conexão com o banco Postgres: | |
from datetime import datetime | |
from peewee import PostgresqlDatabase, CompositeKey, Model, CharField, DateTimeField | |
db = PostgresqlDatabase( | |
'ALTERDATA_WSHOP', # Required by Peewee. | |
user='postgres', # Will be passed directly to psycopg2. | |
password='#abc123#', # Ditto. | |
host='localhost') # Ditto. |