Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Versión 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelDreemurr committed Jun 8, 2021
1 parent a48f162 commit 37ff6f2
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 10 deletions.
Binary file modified Parte 2/Flores/Flores/__pycache__/settings.cpython-38.pyc
Binary file not shown.
Binary file modified Parte 2/Flores/Flores/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified Parte 2/Flores/app/__pycache__/forms.cpython-38.pyc
Binary file not shown.
Binary file modified Parte 2/Flores/app/__pycache__/urls.cpython-38.pyc
Binary file not shown.
Binary file modified Parte 2/Flores/app/__pycache__/views.cpython-38.pyc
Binary file not shown.
11 changes: 10 additions & 1 deletion Parte 2/Flores/app/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django import forms
from django.forms import ModelForm, fields
from .models import producto
from .models import producto
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User

class productoForm(ModelForm):

Expand All @@ -11,3 +13,10 @@ class Meta:
model = producto
fields = ['nombre', 'precio', 'tipo', 'imagen']

class SignUpForm(UserCreationForm):

class Meta:
model = User
fields = ['username', 'first_name', 'last_name', 'email', 'password1', 'password2']


16 changes: 14 additions & 2 deletions Parte 2/Flores/app/static/app/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ header{
transition: 0.3s;
}

.inventario-btn{
padding: 15px 30px;
border-radius: 99px;
background: rgb(53, 53, 197);
}

.inventario-btn:hover {
background-color: blue;
color: white;
transition: 0.3s;
}


header nav{
/*Flex*/
Expand Down Expand Up @@ -303,7 +315,7 @@ footer {
}

/* Full-width inputs */
.inicio-sesion input[name=uname], input[type=password] {
.inicio-sesion input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
Expand Down Expand Up @@ -677,4 +689,4 @@ footer {

.page-link:hover{
background-color: rgb(29, 85, 33);
}
}
24 changes: 24 additions & 0 deletions Parte 2/Flores/app/static/app/js/sweetAlert2.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,27 @@ function confirmarModificar(id){
}
})
}

function exitoRegistro(){
Swal.fire({
title: 'Estás a punto de crear una nueva cuenta',
text: "Confirma dando click abajo y tu cuenta quedará habilitada.",
icon: 'info',
showCancelButton: false,
confirmButtonColor: '#4CAF50',
cancelButtonColor: '#d33',
confirmButtonText: '¡Sí, crear cuenta!',
cancelButtonText: '¡No, olvidé algo!',
backdrop: true
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'¡Cuenta creada con éxito!',
'Volviendo al homepage...',
'success'
).then(function(){
window.location.href = "/index"
})
}
})
}
4 changes: 2 additions & 2 deletions Parte 2/Flores/app/templates/app/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<li><a href="{% url 'productos'%}" class="producto-btn">Productos</a></li>
<li><a href="{% url 'about' %}" class="contacto-btn">Contacto</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'logout' %}" class="socio-btn">Cerrar Sesión</a></li>
<li><a href="{% url 'lista_productos' %}" class="socio-btn">Inventario</a></li>
<li><a href="{% url 'lista_productos' %}" class="inventario-btn">Inventario</a></li>
<li><a href="{% url 'logout' %}" class="socio-btn">Cerrar Sesión de {{user.first_name}}</a></li>
{% else %}
<li><a href="{% url 'login' %}" class="socio-btn">Acceso Staff</a></li>
{% endif %}
Expand Down
3 changes: 2 additions & 1 deletion Parte 2/Flores/app/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
<div class="login">
{% csrf_token %}

<table>
<table class="t_login">
{{ form|crispy }}
</table>
<input type="submit" class="submit" value="Iniciar Sesión">
<input type="reset" class="submit" value="Limpiar">
<a href="{% url 'registro_usuario' %}">¿No tienes cuenta?</a>
</div>
</form>
{{ mensaje }}
Expand Down
19 changes: 19 additions & 0 deletions Parte 2/Flores/app/templates/registration/signup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'app/base.html' %}
{% load static %}
{% load crispy_forms_tags %}

{% block contenido %}
<form action="" method="POST" class="inicio-sesion">
<div class="login">
<h2 class="">Registrar nueva cuenta</h2>
{% csrf_token %}

<table>
{{ form|crispy }}
</table>
<input type="submit" class="submit" value="Registrarse">
<input type="reset" class="submit" value="Limpiar">
</div>
</form>
{{ mensaje }}
{% endblock %}
3 changes: 2 additions & 1 deletion Parte 2/Flores/app/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.urls import path
from .views import eliminar, index, about, login, modificar, productos, agregar, lista_productos
from .views import *

urlpatterns = [
path('', index, name="index"),
Expand All @@ -10,4 +10,5 @@
path('agregar/', agregar, name="agregar"),
path('modificar/<id>/', modificar, name="modificar"),
path('eliminar/<id>/', eliminar, name="eliminar"),
path('registro_usuario/', registro_usuario, name="registro_usuario")
]
19 changes: 17 additions & 2 deletions Parte 2/Flores/app/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib.auth import authenticate
from django.core import paginator
from app.forms import productoForm
from .forms import productoForm, SignUpForm
from django.shortcuts import redirect, render
from .models import producto
from django.http import Http404
Expand Down Expand Up @@ -77,4 +78,18 @@ def eliminar(request, id):
product = producto.objects.get(id=id)
product.delete()

return redirect(to="lista_productos")
return redirect(to="lista_productos")

def registro_usuario(request):
datos = {
'form' : SignUpForm()
}

if request.method == 'POST':
formulario2 = SignUpForm(request.POST)
if formulario2.is_valid():
formulario2.save()
usuario = authenticate(username=formulario2.cleaned_data["username"],password=formulario2.cleaned_data["password1"])
return redirect(to='index')

return render(request, 'registration/signup.html', datos)
Binary file modified Parte 2/Flores/db.sqlite3
Binary file not shown.
5 changes: 4 additions & 1 deletion Parte 2/contraseña admin pagina.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Flores
Flores123
Flores123

FreeFire
pubg12345

0 comments on commit 37ff6f2

Please sign in to comment.