Book Image

Django 1.2 E-commerce

By : Jesse Legg
Book Image

Django 1.2 E-commerce

By: Jesse Legg

Overview of this book

<p>Django is a high-level Python web framework that was developed by a fast-moving online-news operation to meet the stringent twin challenges of newsroom deadlines and the needs of web developers. It provides an excellent basis to build e-commerce websites because it can be deployed fast and it responds quickly to changes due to its ability to handle content problems. Django with its proven strengths is all you need to build powerful e-commerce applications with a competitive edge. <br /><br />This book explores how the Django web framework and its related technologies can power the next leap forward for e-commerce and business on the Web. It shows you how to build real-world applications using this rapid and powerful development tool.<br /><br />The book will enable you to build a high quality e-commerce site quickly and start making money. It starts with the ambitious task of using Django to build a functional e-commerce store in less than 30 minutes, and then proceeds to enhance this design through the rest of the book. The book covers the basics of an e-commerce platform like product catalogs, shopping carts, and payment processing. By the end of the book, you will be able to enhance the application by adding a fully-functional search engine, generating PDF-based reports, adding interactivity to the user-interface, selling digital goods with micropayments, and managing deployment and maintenance tasks.</p>
Table of Contents (16 chapters)
Django 1.2 e-commerce
Credits
About the Author
About the Reviewers
Preface
Index

MySQL simple index searches


If you are using the MySQL database system and MyISAM tables, a very simple Django search interface exists automatically. This is a feature builtin to the Django ORM layer that allows you to perform boolean full-text searches directly from a filter() method call on any QuerySet.

The only caveat to this is that you must build a full text index on the columns you want to search. This is a one-time step, but it's by far the easiest way to get search up and running on your Django application.

The ORM search syntax looks like this:

>>> results = Product.objects.filter(name__search='+cranberry -sauce')

Note the use of + and - characters, which act as operators to explicitly define the search criteria. This is a boolean search, which is very different from what you might expect based on the use of major search engines such as Google or Bing. Boolean search looks for the presence or absence of the terms provided in the simplest way possible. If the term is prefixed...