-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Formulario y vista para proponer una nueva charla #217
Changes from 6 commits
2f391fd
5c973e5
03113da
559c971
c9e0959
661e658
07165a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-10-07 12:27-0500\n" | ||
"POT-Creation-Date: 2023-10-27 18:39-0500\n" | ||
"PO-Revision-Date: 2023-09-05 23:34-0500\n" | ||
"Last-Translator: Sergio Orozco <[email protected]>\n" | ||
"Language-Team: \n" | ||
|
@@ -18,6 +18,32 @@ msgstr "" | |
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 3.0.1\n" | ||
|
||
#: htmlcov/d_afce42a2cf3d92da_base_html.html:140 temii/templates/base.html:58 | ||
msgid "Admin" | ||
msgstr "Administrador" | ||
|
||
#: htmlcov/d_afce42a2cf3d92da_base_html.html:148 temii/templates/base.html:66 | ||
msgid "My Profile" | ||
msgstr "Mi perfil" | ||
|
||
#: htmlcov/d_afce42a2cf3d92da_base_html.html:155 | ||
#: temii/templates/account/logout.html:5 temii/templates/account/logout.html:8 | ||
#: temii/templates/account/logout.html:17 temii/templates/base.html:73 | ||
msgid "Sign Out" | ||
msgstr "Salir" | ||
|
||
#: htmlcov/d_afce42a2cf3d92da_base_html.html:161 | ||
#: temii/templates/account/signup.html:9 temii/templates/account/signup.html:19 | ||
#: temii/templates/base.html:79 | ||
msgid "Sign Up" | ||
msgstr "Inscribirse" | ||
|
||
#: htmlcov/d_afce42a2cf3d92da_base_html.html:166 | ||
#: temii/templates/account/login.html:7 temii/templates/account/login.html:11 | ||
#: temii/templates/account/login.html:56 temii/templates/base.html:84 | ||
msgid "Sign In" | ||
msgstr "Iniciar sesión" | ||
|
||
#: temii/talks/apps.py:7 | ||
msgid "Talks" | ||
msgstr "Charlas" | ||
|
@@ -66,23 +92,37 @@ msgstr "Nivel" | |
msgid "Language" | ||
msgstr "Lenguaje" | ||
|
||
#: temii/talks/models.py:26 | ||
#: temii/talks/models.py:27 | ||
msgid "Timezone" | ||
msgstr "Zona horaria" | ||
|
||
#: temii/talks/models.py:27 | ||
#: temii/talks/models.py:30 | ||
msgid "" | ||
"Timezone of the place you are located. E.g., Colombia (UTC-5), Argentina or " | ||
"Chile (UTC-3), Mexico (UTC-6), etc." | ||
msgstr "ona horaria del lugar donde se encuentra. Por ejemplo," | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. msgstr "Zona horaria del lugar donde se encuentra. Por ejemplo," There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jeje ups. Ya lo corregí |
||
"Colombia (UTC-5), Argentina o Chile (UTC-3), México (UTC-6), etc." | ||
|
||
#: temii/talks/models.py:34 | ||
msgid "Comments" | ||
msgstr "Comentarios" | ||
|
||
#: temii/talks/models.py:28 | ||
#: temii/talks/models.py:35 | ||
msgid "Precense" | ||
msgstr "Presencialidad" | ||
|
||
#: temii/talks/models.py:29 | ||
#: temii/talks/models.py:37 | ||
msgid "Months" | ||
msgstr "Meses" | ||
|
||
#: temii/talks/models.py:32 | ||
#: temii/talks/models.py:41 | ||
msgid "" | ||
"Please write your time availability in months.The more specific, the better. " | ||
"E.g., October and November, any day after 6pm." | ||
msgstr "Por favor escribe tu disponibilidad de tiempo en meses. Cuanto más específico, mejor." | ||
"Por ejemplo, octubre y noviembre, cualquier día después de las 6 p.m." | ||
|
||
#: temii/talks/models.py:47 | ||
msgid "Talk" | ||
msgstr "Charla" | ||
|
||
|
@@ -178,18 +218,13 @@ msgstr "Confirmar" | |
#: temii/templates/account/email_confirm.html:27 | ||
#, python-format | ||
msgid "" | ||
"This e-mail confirmation link expired or is invalid. Please <a " | ||
"href=\"%(email_url)s\">issue a new e-mail confirmation request</a>." | ||
"This e-mail confirmation link expired or is invalid. Please <a href=" | ||
"\"%(email_url)s\">issue a new e-mail confirmation request</a>." | ||
msgstr "" | ||
"Este enlace de confirmación de correo electrónico expiro o es invalido. Por " | ||
"favor <a href=\"%(email_url)s\">solicite una nueva confirmación de correo " | ||
"electrónico</a>." | ||
|
||
#: temii/templates/account/login.html:7 temii/templates/account/login.html:11 | ||
#: temii/templates/account/login.html:56 temii/templates/base.html:76 | ||
msgid "Sign In" | ||
msgstr "Iniciar sesión" | ||
|
||
#: temii/templates/account/login.html:17 | ||
msgid "Please sign in with one of your existing third party accounts:" | ||
msgstr "" | ||
|
@@ -211,21 +246,16 @@ msgstr "o" | |
#: temii/templates/account/login.html:41 | ||
#, python-format | ||
msgid "" | ||
"If you have not created an account yet, then please <a " | ||
"href=\"%(signup_url)s\">sign up</a> first." | ||
"If you have not created an account yet, then please <a href=\"%(signup_url)s" | ||
"\">sign up</a> first." | ||
msgstr "" | ||
"Si no has creado tu cuenta aún, por favor <a " | ||
"href=\"%(signup_url)s\">registrate</a>." | ||
"Si no has creado tu cuenta aún, por favor <a href=\"%(signup_url)s" | ||
"\">registrate</a>." | ||
|
||
#: temii/templates/account/login.html:55 | ||
msgid "Forgot Password?" | ||
msgstr "Olvido su contraseña?" | ||
|
||
#: temii/templates/account/logout.html:5 temii/templates/account/logout.html:8 | ||
#: temii/templates/account/logout.html:17 temii/templates/base.html:65 | ||
msgid "Sign Out" | ||
msgstr "Salir" | ||
|
||
#: temii/templates/account/logout.html:10 | ||
msgid "Are you sure you want to sign out?" | ||
msgstr "¿Estás seguro que deseas salir?" | ||
|
@@ -302,11 +332,6 @@ msgstr "" | |
msgid "Signup" | ||
msgstr "" | ||
|
||
#: temii/templates/account/signup.html:9 temii/templates/account/signup.html:19 | ||
#: temii/templates/base.html:71 | ||
msgid "Sign Up" | ||
msgstr "" | ||
|
||
#: temii/templates/account/signup.html:11 | ||
#, python-format | ||
msgid "" | ||
|
@@ -357,9 +382,48 @@ msgid "" | |
"mail address</a>." | ||
msgstr "" | ||
|
||
#: temii/templates/base.html:61 | ||
msgid "My Profile" | ||
msgstr "Mi perfil" | ||
#: temii/templates/base.html:62 | ||
msgid "About" | ||
msgstr "" | ||
|
||
#: temii/templates/base.html:69 temii/templates/talks/talk_form.html:8 | ||
msgid "Propose a talk" | ||
msgstr "Proponer una charla" | ||
|
||
#: temii/templates/talks/talk_form.html:4 | ||
msgid "Create Talk" | ||
msgstr "Crear una charla" | ||
|
||
#: temii/templates/talks/talk_form.html:10 | ||
msgid "Here you can propose a future talk" | ||
msgstr "Aquí puedes proponer una futura charla" | ||
|
||
#: temii/templates/talks/talk_form.html:11 | ||
msgid "" | ||
"If you wish to make more than one proposal, you must fill out the form again" | ||
msgstr "Si deseas hacer más de una propuesta debes diligenciar nuevamente el formulario" | ||
|
||
#: temii/templates/talks/talk_form.html:18 | ||
#: temii/templates/users/user_form.html:13 | ||
msgid "Save" | ||
msgstr "Guardar" | ||
|
||
#: temii/templates/talks/talk_thanks.html:4 | ||
#: temii/templates/talks/talk_thanks.html:11 | ||
msgid "Thanks for your proposal" | ||
msgstr "Gracias por tu propuesta" | ||
|
||
#: temii/templates/talks/talk_thanks.html:13 | ||
msgid "Your contribution greatly contributes to the community" | ||
msgstr "Tu aporte contribuye enormemente a la comunidad" | ||
|
||
#: temii/templates/talks/talk_thanks.html:16 | ||
msgid "If you wish, you can" | ||
msgstr "Si deseas, puedes" | ||
|
||
#: temii/templates/talks/talk_thanks.html:17 | ||
msgid "propose another talk again" | ||
msgstr "volver a proponer otra charla" | ||
|
||
#: temii/templates/users/user_detail.html:19 temii/users/forms.py:37 | ||
#: temii/users/models.py:23 | ||
|
@@ -379,10 +443,6 @@ msgstr "Actualizar" | |
msgid "E-Mail" | ||
msgstr "Coreo electrónico" | ||
|
||
#: temii/templates/users/user_form.html:13 | ||
msgid "Save" | ||
msgstr "Guardar" | ||
|
||
#: temii/users/admin.py:17 | ||
msgid "Personal info" | ||
msgstr "Información personal" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django import forms | ||
|
||
from .models import Talk | ||
|
||
|
||
class NewTalkForm(forms.ModelForm): | ||
class Meta: | ||
model = Talk | ||
fields = [ | ||
"name", | ||
"description", | ||
"level", | ||
"language", | ||
"timezone", | ||
"comments", | ||
"precense", | ||
"months", | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 4.2.1 on 2023-10-31 01:59 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("talks", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="talk", | ||
name="months", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="Please write your time availability in months.The more specific, the better. E.g., October and November, any day after 6pm.", | ||
max_length=100, | ||
verbose_name="Months", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="talk", | ||
name="timezone", | ||
field=models.CharField( | ||
help_text="Timezone of the place you are located. E.g., Colombia (UTC-5), Argentina or Chile (UTC-3), Mexico (UTC-6), etc.", | ||
max_length=60, | ||
verbose_name="Timezone", | ||
), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,10 +23,25 @@ class InPerson(models.IntegerChoices): | |
description = models.CharField(_("Description"), max_length=300) | ||
level = models.PositiveIntegerField(_("Level"), choices=Level.choices, default=Level.BEGINNER) | ||
language = models.CharField(_("Language"), max_length=2, choices=Language.choices, default=Language.ES) | ||
timezone = models.CharField(_("Timezone"), max_length=60) | ||
timezone = models.CharField( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Al cambiar los modelos se requieren crear migraciones, por favor, crealas |
||
_("Timezone"), | ||
max_length=60, | ||
help_text=_( | ||
"Timezone of the place you are located. E.g., " | ||
"Colombia (UTC-5), Argentina or Chile (UTC-3), Mexico (UTC-6), etc." | ||
), | ||
) | ||
comments = models.CharField(_("Comments"), max_length=300) | ||
precense = models.PositiveIntegerField(_("Precense"), choices=InPerson.choices, default=InPerson.ON_SITE) | ||
months = models.CharField(_("Months"), max_length=100, blank=True) | ||
months = models.CharField( | ||
_("Months"), | ||
max_length=100, | ||
blank=True, | ||
help_text=_( | ||
"Please write your time availability in months." | ||
"The more specific, the better. E.g., October and November, any day after 6pm." | ||
), | ||
) | ||
|
||
class Meta: | ||
verbose_name = _("Talk") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import pytest | ||
from django.test import RequestFactory | ||
|
||
from temii.talks.forms import NewTalkForm | ||
from temii.talks.tests.factories import TalkFactory | ||
from temii.talks.views import TalkCreateView | ||
from temii.users.models import User | ||
|
||
pytestmark = pytest.mark.django_db | ||
|
||
|
||
class TestTalkCreateView: | ||
def test_form_valid(self, user: User, rf: RequestFactory): | ||
view = TalkCreateView() | ||
talk = TalkFactory() | ||
request = rf.get("/fake-url/") | ||
request.user = user | ||
|
||
view.request = request | ||
|
||
# Initialize the form | ||
form = NewTalkForm(instance=talk) | ||
form.cleaned_data = {} | ||
view.form_valid(form) | ||
|
||
assert form.instance.user == request.user |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
from django.urls import path | ||
from django.views.generic import TemplateView | ||
|
||
from .views import talk_create_view | ||
|
||
app_name = "talks" | ||
urlpatterns = [ | ||
path("", TemplateView.as_view(template_name="pages/about.html"), name="talks"), | ||
path("~create/", view=talk_create_view, name="create"), | ||
path("thanks/", TemplateView.as_view(template_name="talks/talk_thanks.html"), name="thanks"), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from django.contrib.auth.mixins import LoginRequiredMixin | ||
from django.urls import reverse_lazy | ||
from django.views.generic.edit import CreateView | ||
|
||
from .forms import NewTalkForm | ||
from .models import Talk | ||
|
||
|
||
class TalkCreateView(LoginRequiredMixin, CreateView): | ||
"""Propose a new talk.""" | ||
|
||
model = Talk | ||
form_class = NewTalkForm | ||
success_url = reverse_lazy("talks:thanks") | ||
|
||
def form_valid(self, form): | ||
# Se agrega el usuario que hace la petición al formulario | ||
form.instance.user = self.request.user | ||
return super().form_valid(form) | ||
|
||
|
||
talk_create_view = TalkCreateView.as_view() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creo que seria bueno traducir este mensaje
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.