<commit_before>from .models import Usuario, Pedido, Item, Produto
from django.contrib.auth import authenticate, login, logout
from django.db import models
from .forms import FormLogin, FormCadastro
import json

#contem as operacoes de usuario
class ControllerUsuario:

    def cadastrar(self, request, form):
    	form = FormCadastro(request.POST)
    	if form.is_valid():
	        usuario = form.cleaned_data['username']
	        email = form.cleaned_data['email']
	        telefone = form.cleaned_data['telefone']
	        nome = form.cleaned_data['nome']
	        endereco = form.cleaned_data['endereco']
	        senha = form.cleaned_data['senha']
	        csenha = form.cleaned_data['csenha']
	        cpf = form.cleaned_data['cpf']
	        cep = form.cleaned_data['cep']

	        user = Usuario()
	        user.password =  <PASSWORD>
	        user.email = email
	        user.telefone = telefone
	        user.endereco = endereco
	        user.first_name = nome
	        user.cpf = cpf
	        user.username = usuario
	        user.cep = cep
	        Usuario.save(user)

    def logar(self, request, form):
    	if form.is_valid():
       		usuario = form.cleaned_data['usuario']
       		senha = form.cleaned_data['senha']
       		user = authenticate(username = usuario, password = <PASSWORD>)
        	if user is not None:
	        	login(request, user)
	        	return True
	   	return False

    def logout(self, request):
        logout(request)


class ControllerPedido:

    def salva_pedido(self):
    	try:
            meu_pedido = Pedido()
            listIWantToStore = get_all_pedidos()
	    	myModel.myList = json.dumps(listIWantToStore)<commit_msg>home.html controllers.py<commit_after>from .models import Usuario, Pedido, Item, Produto
from django.contrib.auth import authenticate, login, logout
from django.db import models
from .forms import FormLogin, FormCadastro
import json

#contem as operacoes de usuario
class ControllerUsuario:

    def cadastrar(self, request, form):
    	form = FormCadastro(request.POST)
    	if form.is_valid():
	        usuario = form.cleaned_data['username']
	        email = form.cleaned_data['email']
	        telefone = form.cleaned_data['telefone']
	        nome = form.cleaned_data['nome']
	        endereco = form.cleaned_data['endereco']
	        senha = form.cleaned_data['senha']
	        csenha = form.cleaned_data['csenha']
	        cpf = form.cleaned_data['cpf']
	        cep = form.cleaned_data['cep']

	        user = Usuario()
	        user.password =  <PASSWORD>
	        user.email = email
	        user.telefone = telefone
	        user.endereco = endereco
	        user.first_name = nome
	        user.cpf = cpf
	        user.username = usuario
	        user.cep = cep
	        Usuario.save(user)

    def logar(self, request, form):
    	if form.is_valid():
       		usuario = form.cleaned_data['usuario']
       		senha = form.cleaned_data['senha']
       		user = authenticate(username = usuario, password = <PASSWORD>)
        	if user is not None:
	        	login(request, user)
	        	return True
	        return False

    def logout(self, request):
        logout(request)


class ControllerPedido:

    def salva_pedido(self):
    	try:
            meu_pedido = Pedido()
            listIWantToStore = get_all_pedidos()
	    	myModel.myList = json.dumps(listIWantToStore)
{'fraction_non_alphanumeric': 0.0969949419815531, 'fraction_numerical': 0.0, 'mean_word_length': 2.4166666666666665, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2054060', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1083, 'n_words': 234}