Commit 257b6041 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Trim whitespace from input fields.

parent e1ab9f80
......@@ -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:]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment