Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit f42f814

Browse files
authored
Ep19/adjustments for cms (#871)
* added cms toolbar * replace homegrown bootstrap forms lib with crispy bootstrap4 pack * more homepage improvements with placeholder data * added news and further updates to homepage * added commented out version of a logo * Remove custom skin for CK Editor * some footer improvements including cms menu * small cms adjustment * Fix the initial fixture placeholder name. * readded cookie consent from ep18 * improved registration form; added dev_settings and test_settings; fixed email handling during registration; added fontawesome * fixed requirements * handle password reset with new templates * fixed tests * added password change views to user panel * removed old registration templates * removed some old, now unused, mostly assopy code related to account management * more updates for 2019, cleaned up some settings * reorganize CMS seed, fix db path in redo_db in Makefile
1 parent 63116c0 commit f42f814

File tree

88 files changed

+2011
-1743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+2011
-1743
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.vimrc
2+
tags
13
*.pyc
24
*.swp
35
settings_locale.py

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ db:
3737
python manage.py migrate
3838
python manage.py create_initial_data_for_dev
3939

40+
41+
drop_db:
42+
rm -f data/site/epcon.db
43+
44+
redo_db: drop_db db
45+
4046
test:
4147
pytest -n auto
4248

@@ -46,8 +52,8 @@ test-no-warnings:
4652
test-no-django-20-warnings:
4753
pytest -c pytest_no_django_20_warnings.ini
4854

49-
server:
50-
DEBUG=True ./manage.py runserver 0:37266
55+
server-dev:
56+
DJANGO_SETTINGS_MODULE="pycon.dev_settings" DEBUG=True ./manage.py runserver 0:37266
5157

5258
shell:
5359
DEBUG=True ./manage.py shell_plus

assets/css/ep19-customisations.css

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,27 @@
33
/* secondary: d87a00 */
44
/* secondary-light: f8c48f */
55

6+
.text-primary-light { color: #76bdc4; }
7+
.text-secondary-light { color: #f8c48f; }
8+
69
#background_image {
710
background: url('/static/img/ep19-basel-dark.jpg');
811
background-size: cover;
912
color: white;
1013
min-height: 90px
1114
}
1215
.jumbotron { height: 800px; background: transparent; color: white; }
16+
.text-underline { text-decoration: underline; }
1317

18+
.page { min-height: 500px; padding-bottom: 10em; }
1419
#footer { background: #007d8a; padding: 1em 0; color: #f8c48f}
15-
#footer a { color: white; border-bottom: 1px solid #eee; }
16-
#homepage_venue { background: #d87a00; padding: 1em 0; margin: 1em 0}
20+
#footer a { color: white; border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
21+
#footer ul { list-style-type: none; padding-left: 0}
22+
#footer ul li { margin: .5em 0; }
23+
#homepage_news { background: #007d8a; padding: 2em 0; margin 0:}
24+
.news-card { height: 300px; }
25+
26+
#homepage_venue { background: #d87a00; padding: 1em 0; margin: 0}
1727
#homepage_schedule_overview { margin: 2em 0; }
1828

1929
#tickets-link-header { color: #fff; border-bottom: 2px solid #fff; margin-right: 2px }
@@ -28,16 +38,26 @@
2838
color: white;
2939
border-bottom: 2px solid white;
3040
}
41+
a.navbar-brand:hover{
42+
color: white;
43+
}
3144

3245
#content_page {
3346
min-height: 500px;
3447
margin: 40px 0;
3548
}
49+
#sidebar ul {
50+
padding-left: 0;
51+
}
3652

37-
ul.cms_menu { margin-left: 0px; padding-left: 15px; margin-bottom: 30px}
38-
li.cms_menu { margin-top: .7em; list-style-type: none}
39-
li.cms_menu.ancestor { background: #eee; padding: .5em; border-radius: 5px}
40-
li.cms_menu.selected { font-weight: bold; }
53+
#sidebar li ul {
54+
padding-left: 20px;
55+
}
56+
57+
#sidebar ul.cms_menu { margin-left: 0px; padding-left: 15px; margin-bottom: 30px}
58+
#sidebar li.cms_menu { margin-top: .7em; list-style-type: none}
59+
#sidebar li.cms_menu.ancestor { background: #f6f6f6; padding: .5em; }
60+
#sidebar li.cms_menu.selected { font-weight: bold; }
4161

4262

4363
#user_panel {
@@ -49,3 +69,9 @@ li.cms_menu.selected { font-weight: bold; }
4969
padding-bottom: 10em;
5070
min-height: 500px;
5171
}
72+
73+
.news {
74+
margin: 2em 0;
75+
padding: 1em 0;
76+
border-bottom: 1px dashed #eee;
77+
}

assets/img/conference_venue.png

1.08 MB
Loading

assets/img/epslogo.png

13 KB
Loading

assets/img/logo-wide-640px.png

43 KB
Loading

assets/img/sprints_venue.png

689 KB
Loading

assets/img/tmplogo-small.png

28.1 KB
Loading

assopy/forms.py

Lines changed: 1 addition & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
2-
31
from django import forms
4-
from django.contrib import auth
52
from django.conf import settings as dsettings
63
from django.utils.translation import ugettext as _
74

@@ -13,6 +10,7 @@
1310

1411
log = logging.getLogger('assopy.forms')
1512

13+
1614
# autostrip - http://djangosnippets.org/snippets/956/
1715
# il motivo per questo abominio?
1816
# http://code.djangoproject.com/ticket/6362
@@ -36,44 +34,6 @@ def get_clean_func(original_clean):
3634
""".strip()
3735

3836

39-
class LoginForm(auth.forms.AuthenticationForm):
40-
email = forms.EmailField()
41-
i_accept_privacy_policy = forms.BooleanField(
42-
label=PRIVACY_POLICY_CHECKBOX
43-
)
44-
45-
def __init__(self, *args, **kwargs):
46-
super(LoginForm, self).__init__(*args, **kwargs)
47-
del self.fields['username']
48-
49-
def clean(self):
50-
data = self.cleaned_data
51-
if not data.get('i_accept_privacy_policy'):
52-
raise forms.ValidationError(PRIVACY_POLICY_ERROR)
53-
54-
if data.get('email') and data.get('password'):
55-
user = auth.authenticate(email=data['email'],
56-
password=data['password'])
57-
self.user_cache = user
58-
if user is None:
59-
raise forms.ValidationError('Invalid credentials')
60-
elif not user.is_active:
61-
raise forms.ValidationError('This account is inactive.')
62-
return data
63-
64-
65-
class SetPasswordForm(auth.forms.SetPasswordForm):
66-
def save(self, *args, **kwargs):
67-
user = super(SetPasswordForm, self).save(*args, **kwargs)
68-
# u = self.user.assopy_user
69-
# non voglio riabilitare un utente con is_active=False, voglio tenermi
70-
# questo flag come uno strumento di amministrazione per impedire
71-
# l'accesso al sito
72-
# if not u.verified:
73-
# log.info('password reset for "%s" completed; now he\' a verified user', user.email)
74-
# u.verified = True
75-
# u.save()
76-
return user
7737

7838
class Profile(forms.ModelForm):
7939
first_name = forms.CharField(
@@ -137,72 +97,6 @@ def clean_card_name(self):
13797
BillingData = autostrip(BillingData)
13898

13999

140-
class NewAccountForm(forms.Form):
141-
142-
first_name = forms.CharField(max_length=32)
143-
last_name = forms.CharField(max_length=32)
144-
email = forms.EmailField()
145-
password1 = forms.CharField(label="Password",
146-
widget=forms.PasswordInput)
147-
password2 = forms.CharField(label="Confirm password",
148-
widget=forms.PasswordInput)
149-
150-
# Additional captcha field with simple python questions
151-
# https://github.com/EuroPython/epcon/issues/703
152-
captcha_question = forms.CharField(widget=forms.HiddenInput)
153-
captcha_answer = forms.CharField()
154-
155-
# Keep this in sync with LoginForm.i_accept_privacy_policy
156-
i_accept_privacy_policy = forms.BooleanField(
157-
label=PRIVACY_POLICY_CHECKBOX
158-
)
159-
160-
def __init__(self, *args, **kwargs):
161-
super(NewAccountForm, self).__init__(*args, **kwargs)
162-
random_question = self.get_random_captcha_question()
163-
if random_question:
164-
self.fields['captcha_question'].initial = random_question.question
165-
self.fields['captcha_answer'].label = random_question.question
166-
else:
167-
del self.fields['captcha_question']
168-
del self.fields['captcha_answer']
169-
170-
def get_random_captcha_question(self):
171-
try:
172-
return cmodels.CaptchaQuestion.objects.get_random_question()
173-
except cmodels.CaptchaQuestion.NoQuestionsAvailable:
174-
return None
175-
176-
def clean_captcha_answer(self):
177-
question = self.cleaned_data['captcha_question']
178-
cq = cmodels.CaptchaQuestion.objects.get(question=question)
179-
if cq.answer.strip() != self.cleaned_data['captcha_answer'].strip():
180-
raise forms.ValidationError("Sorry, that's a wrong answer")
181-
return self.cleaned_data['captcha_question']
182-
183-
def clean_email(self):
184-
email = self.cleaned_data['email']
185-
if auth.models.User.objects.filter(email__iexact=email).count() > 0:
186-
raise forms.ValidationError('Email already in use')
187-
188-
return email.lower()
189-
190-
def clean(self):
191-
if not self.cleaned_data.get('i_accept_privacy_policy'):
192-
raise forms.ValidationError(PRIVACY_POLICY_ERROR)
193-
194-
if not self.is_valid():
195-
return super(NewAccountForm, self).clean()
196-
197-
data = self.cleaned_data
198-
if data['password1'] != data['password2']:
199-
raise forms.ValidationError('password mismatch')
200-
return data
201-
202-
203-
NewAccountForm = autostrip(NewAccountForm)
204-
205-
206100
class FormTickets(forms.Form):
207101
payment = forms.ChoiceField(choices=(('paypal', 'PayPal'),('bank', 'Bank')))
208102
order_type = forms.ChoiceField(

0 commit comments

Comments
 (0)