Last active
June 10, 2023 17:35
-
-
Save hcosta/3302f2cf81b71872c503b405adfb1708 to your computer and use it in GitHub Desktop.
Revisión del formulario de perfil con avatar
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
{% extends 'core/base.html' %} | |
{% load static %} | |
{% block title %}Perfil{% endblock %} | |
{% block content %} | |
<style>.errorlist{color:red;} label{display:none}</style> | |
<main role="main"> | |
<div class="container"> | |
<div class="row mt-3"> | |
<div class="col-md-9 mx-auto mb-5"> | |
<form action="" method="post" enctype="multipart/form-data">{% csrf_token %} | |
<div class="row"> | |
<!-- Previa del avatar --> | |
<div class="col-md-2"> | |
{% if request.user.profile.avatar %} | |
<img src="{{request.user.profile.avatar.url}}" class="img-fluid"> | |
<p class="mt-1">¿Borrar? <input type="checkbox" id="avatar-clear" name="avatar-clear" /></p> | |
{% endif %} | |
</div> | |
<!-- Formulario --> | |
<div class="col-md-10"> | |
<h3>Perfil</h3> | |
<input type="file" name="avatar" class="form-control-file mt-3" id="id_avatar"> | |
{{ form.bio }} | |
{{ form.link }} | |
<input type="submit" class="btn btn-primary btn-block mt-3" value="Actualizar"> | |
</div> | |
</div> | |
</form> | |
</div> | |
</div> | |
</div> | |
</main> | |
{% endblock %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Estoy usando Django 2.2.17 y funciona sin problemas.