Skip to content

Commit 1362c73

Browse files
committed
Fix CFP layout
1 parent a76945b commit 1362c73

6 files changed

Lines changed: 249 additions & 189 deletions

File tree

apps/events/forms.py

Lines changed: 64 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,64 @@
22

33
from django import forms
44

5-
from .models import Refund, Proposal
5+
from .models import Proposal, Refund
66

77
UUID_LAST_DIGITS = 12
88

99

1010
class ProposalForm(forms.ModelForm):
11-
1211
class Meta:
1312
model = Proposal
1413
fields = [
15-
'name',
16-
'surname',
17-
'email',
18-
'title',
19-
'description',
14+
"name",
15+
"surname",
16+
"email",
17+
"title",
18+
"description",
2019
]
2120

2221
def __init__(self, event, *args, **kwargs):
2322
super().__init__(*args, **kwargs)
24-
self.fields["name"].widget.attrs.update({'id': 'cfp-name', 'size': '20',
25-
'placeholder': 'Tu nombre'})
26-
self.fields["surname"].widget.attrs.update({'id': 'cfp-surname', 'size': '40',
27-
'placeholder': 'Tus apellidos'})
28-
self.fields["email"].widget.attrs.update({
29-
'id': 'cfp-email',
30-
'size': '40',
31-
'placeholder': 'Tu email'
32-
})
33-
self.fields["title"].widget.attrs.update({
34-
'id': 'cfp-title',
35-
'size': '60',
36-
'placeholder': 'El título de tu maravillosa charla'})
37-
self.fields["description"].widget.attrs.update({'id': 'cfp-title',
38-
'cols': '60', 'rows': '20'})
23+
self.fields["name"].widget.attrs.update(
24+
{
25+
"id": "cfp-name",
26+
"size": "20",
27+
"placeholder": "Tu nombre",
28+
"class": "input is-rounded",
29+
}
30+
)
31+
self.fields["surname"].widget.attrs.update(
32+
{
33+
"id": "cfp-surname",
34+
"size": "40",
35+
"placeholder": "Tus apellidos",
36+
"class": "input is-rounded",
37+
}
38+
)
39+
self.fields["email"].widget.attrs.update(
40+
{
41+
"id": "cfp-email",
42+
"size": "40",
43+
"placeholder": "Tu email",
44+
"class": "input is-rounded",
45+
}
46+
)
47+
self.fields["title"].widget.attrs.update(
48+
{
49+
"id": "cfp-title",
50+
"size": "60",
51+
"placeholder": "El título de tu maravillosa charla",
52+
"class": "input is-rounded",
53+
}
54+
)
55+
self.fields["description"].widget.attrs.update(
56+
{
57+
"id": "cfp-title",
58+
"cols": "60",
59+
"rows": "20",
60+
"class": "textarea",
61+
}
62+
)
3963
self.event = event
4064

4165
def save(self):
@@ -46,51 +70,50 @@ def save(self):
4670

4771

4872
class EmailForm(forms.Form):
49-
email = forms.EmailField(label='Tu email', max_length=192)
73+
email = forms.EmailField(label="Tu email", max_length=192)
5074

5175

5276
class WaitingListForm(forms.Form):
53-
email = forms.EmailField(label='Tu email', max_length=192)
54-
name = forms.CharField(label='Nombre', max_length=256)
55-
surname = forms.CharField(label='Apellidos', max_length=256)
56-
phone = forms.CharField(label='Teléfono', max_length=32)
77+
email = forms.EmailField(label="Tu email", max_length=192)
78+
name = forms.CharField(label="Nombre", max_length=256)
79+
surname = forms.CharField(label="Apellidos", max_length=256)
80+
phone = forms.CharField(label="Teléfono", max_length=32)
5781

5882

5983
class RefundForm(forms.Form):
60-
email = forms.EmailField(label='Tu email', max_length=192)
84+
email = forms.EmailField(label="Tu email", max_length=192)
6185
uuid = forms.CharField()
6286

6387
def __init__(self, event, *args, **kwargs):
64-
logging.error('Llamada al metodo __init__ de RefundForm')
88+
logging.error("Llamada al metodo __init__ de RefundForm")
6589
super().__init__(*args, **kwargs)
6690
self.event = event
6791

6892
def clean_uuid(self):
6993
email = self.cleaned_data["email"]
7094
uuid = self.cleaned_data["uuid"]
71-
if uuid == 'tu puta madre':
72-
raise forms.ValidationError('Cuida ese vocabulario')
95+
if uuid == "tu puta madre":
96+
raise forms.ValidationError("Cuida ese vocabulario")
7397

7498
if len(uuid) < UUID_LAST_DIGITS:
7599
raise forms.ValidationError(
76-
'Necesito los últimos () letras o dígitos '
77-
'del código'.format(UUID_LAST_DIGITS)
78-
)
100+
"Necesito los últimos () letras o dígitos "
101+
"del código".format(UUID_LAST_DIGITS)
102+
)
79103
uuid = uuid[-UUID_LAST_DIGITS:]
80104
tickets = list(
81105
self.event.all_tickets()
82106
.filter(customer_email=email)
83107
.filter(keycode__iendswith=uuid)
84-
)
108+
)
85109
if len(tickets) != 1:
86110
raise forms.ValidationError(
87-
'El correo o las últimos {} letras o dígitos del'
88-
' codigo están mal.'.format(UUID_LAST_DIGITS)
89-
)
111+
"El correo o las últimos {} letras o dígitos del"
112+
" codigo están mal.".format(UUID_LAST_DIGITS)
113+
)
90114
self.ticket = tickets[0]
91115
if Refund.exists(self.event, self.ticket):
92116
raise forms.ValidationError(
93-
'Ya se ha solicitado una devolución del'
94-
' importe para ese ticket'
95-
)
117+
"Ya se ha solicitado una devolución del" " importe para ese ticket"
118+
)
96119
return uuid
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Generated by Django 3.2.13 on 2022-05-16 17:02
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('events', '0018_auto_20220510_2236'),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name='event',
15+
options={'ordering': ['-start_date']},
16+
),
17+
migrations.AlterField(
18+
model_name='proposal',
19+
name='description',
20+
field=models.TextField(help_text='Cuéntamos en dos o tres párrafos tu propuesta de charla.', verbose_name='Descripción'),
21+
),
22+
migrations.AlterField(
23+
model_name='proposal',
24+
name='email',
25+
field=models.EmailField(blank=True, max_length=254, verbose_name='Email'),
26+
),
27+
migrations.AlterField(
28+
model_name='proposal',
29+
name='name',
30+
field=models.CharField(max_length=256, verbose_name='Nombre'),
31+
),
32+
migrations.AlterField(
33+
model_name='proposal',
34+
name='surname',
35+
field=models.CharField(max_length=256, verbose_name='Apellidos'),
36+
),
37+
migrations.AlterField(
38+
model_name='proposal',
39+
name='title',
40+
field=models.CharField(max_length=340, verbose_name='Título'),
41+
),
42+
]

0 commit comments

Comments
 (0)