Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
bookshare
Commits
257b6041
Commit
257b6041
authored
Dec 13, 2013
by
Jean Michel Rouly
Browse files
Trim whitespace from input fields.
parent
e1ab9f80
Changes
1
Hide whitespace changes
Inline
Side-by-side
bookshare/website/views.py
View file @
257b6041
...
...
@@ -155,6 +155,12 @@ def create_listing(request):
if
listing_form
.
is_valid
():
listing
=
listing_form
.
save
(
commit
=
False
)
# Trim unnecessary whitespace chars from the sides.
listing
.
title
=
listing
.
title
.
strip
()
listing
.
author
=
listing
.
author
.
strip
()
listing
.
edition
=
listing
.
edition
.
strip
()
# Trim the word "by" if it starts the author field.
if
len
(
listing
.
author
)
>=
2
and
listing
.
author
[:
2
].
lower
()
==
"by"
:
listing
.
author
=
listing
.
author
[
2
:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment