Kai Diefenbach avatar Kai Diefenbach committed ceccf90

Cleaned up docs and doc strings.

Comments (0)

Files changed (6)

docs/developer/api.rst

 
     **Attributes:**
 
-        cart
-            The current cart of the current customer.
+    cart
+        The current cart of the current customer.
 
-        content
-            The content object the criterion belongs to.
+    content
+        The content object the criterion belongs to.
 
-        operator
-            The current selected operator for the criterion.
+    operator
+        The current selected operator for the criterion.
 
-        position
-            The position of the criterion within a list of criteria of the
-            content object.
+    position
+        The position of the criterion within a list of criteria of the
+        content object.
 
-        product
-            The product, if the criterion is called from a product detail view.
-            Otherwise this is None.
+    product
+        The product, if the criterion is called from a product detail view.
+        Otherwise this is None.
 
-        request
-            The current request.
+    request
+        The current request.
 
     **Constants:**
 
-        EQUAL, LESS_THAN, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL, IS_SELECTED, IS_NOT_SELECTED, IS_VALID, IS_NOT_VALID, CONTAINS
-            Integers which represents certain operators.
+    EQUAL, LESS_THAN, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL, IS_SELECTED, IS_NOT_SELECTED, IS_VALID, IS_NOT_VALID, CONTAINS
+        Integers which represents certain operators.
 
-        INPUT, SELECT, MULTIPLE_SELECT
-            Constants which represents the types of selectable values. One of
-            these must be returned from the ``get_value_type`` method.
+    INPUT, SELECT, MULTIPLE_SELECT
+        Constants which represents the types of selectable values. One of
+        these must be returned from ``get_value_type``.
 
-        NUMBER_OPERATORS
-            A list of operators which can be returned from the ``get_operators``
-            method.
+    NUMBER_OPERATORS
+        A list of operators which can be returned from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [EQUAL, _(u"Equal to")],
-                    [LESS_THAN, _(u"Less than")],
-                    [LESS_THAN_EQUAL, _(u"Less than equal to")],
-                    [GREATER_THAN, _(u"Greater than")],
-                    [GREATER_THAN_EQUAL, _(u"Greater than equal to")],
-                ]
+            [
+                [EQUAL, _(u"Equal to")],
+                [LESS_THAN, _(u"Less than")],
+                [LESS_THAN_EQUAL, _(u"Less than equal to")],
+                [GREATER_THAN, _(u"Greater than")],
+                [GREATER_THAN_EQUAL, _(u"Greater than equal to")],
+            ]
 
 
-        SELECTION_OPERATORS
-            A list of operators which can be returned from the ``get_operators``
-            method.
+    SELECTION_OPERATORS
+        A list of operators which can be returned from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [IS_SELECTED, _(u"Is selected")],
-                    [IS_NOT_SELECTED, _(u"Is not selected")],
-                ]
+            [
+                [IS_SELECTED, _(u"Is selected")],
+                [IS_NOT_SELECTED, _(u"Is not selected")],
+            ]
 
-        VALID_OPERATORS
-            A list of operators which can be returned from the ``get_operators``
-            method.
+    VALID_OPERATORS
+        A list of operators which can be returned from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [IS_VALID, _(u"Is valid")],
-                    [IS_NOT_VALID, _(u"Is not valid")],
-                ]
+            [
+                [IS_VALID, _(u"Is valid")],
+                [IS_NOT_VALID, _(u"Is not valid")],
+            ]
 
-        STRING_OPERATORS
-            A list of operators which can be returned from the ``get_operators``
-            method.
+    STRING_OPERATORS
+        A list of operators which can be return from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [EQUAL, _(u"Equal to")],
-                    [CONTAINS, _(u"Contains")],
-                ]
+            [
+                [EQUAL, _(u"Equal to")],
+                [CONTAINS, _(u"Contains")],
+            ]
 
     .. py:method:: lfs.criteria.models.Criterion.get_operators
 
                 },
             ]
 
+    .. py:method:: lfs.criteria.models.Criterion.get_template(request)
+
+        Returns the template to render the criterion.
+
     .. py:method:: lfs.criteria.models.Criterion.get_value_type
 
         Returns the type of the selectable values field. Must return one of:
 
         Returns ``True`` if the criterion is valid otherwise ``False``.
 
+    .. py:method:: lfs.criteria.models.Criterion.render(request, position)
+
+        Renders the criterion as html in order to displayed it within the
+        management form.
+
     .. py:method:: lfs.criteria.models.Criterion.update(value)
 
         Updates the value of the criterion.

docs/developer/howtos/how_to_add_own_criteria/index.rst

 How to add an own criteria
 ==========================
 
-In this how-to you will learn how to add an own criterion.
+In this how-to you will learn how to add own criteria to LFS.
 
-The goal is to create a criterion, in which the customer can enter a SKU and
-decide (via operators) whether the criterion is valid if the product, with the
-entered SKU, is in the cart or not.
+The goal in this how-to is to create a criterion, for which the :term:`shop
+manager` can enter a SKU and decide (via operators) whether the criterion is
+valid if the product with the entered SKU is within the cart or not.
 
-Please see also the example application  :download:`product_criterion
-<product_criterion.tar.gz>` or refer to the default implementation of LFS within
-``lfs.criteria.models``.
+You can :download:`download the example application
+<product_criterion.tar.gz>` here.
 
 Create an application
 =====================
 
-First you need to create a default Django application (or use an existing one),
-where  you can put in your plugin. If you do not know how to do this, please
-refer to the excellent `Django tutorial
+First you need to create a default :term:`Django` application (or use an
+existing one), where  you can put in your plugin. If you do not know how to do
+this, please refer to the excellent `Django tutorial
 <http://docs.djangoproject.com/en/dev/intro/tutorial01/>`_.
 
 Implement the Criterion Model
 =============================
 
-The main part of the criterion consists of a model which must inherit from the
-``Criterion`` base class.
+The main part of the application consists of a criterion model which must
+inherit from the ``Criterion`` base class.
 
 Create the Class
 ----------------
     class ProductCriterion(Criterion):
         value = models.CharField(max_length=100)
 
-The only attribute we need is the value the shop admin will save for the
-criterion. The attribute can have any type you need. In this example we use a
-simple character field. This example criterion will be valid, when the the
-product with the given SKU is within the card.
+The only attribute we need is the value the :term:`shop manager` will save for
+the criterion. The attribute can have any type you need. In this example we use
+a simple character field. The entered SKU is checked within the products in the
+cart. Dependent on the chosen operator the criteria is valid if the product is
+within the cart or not.
 
 Implement necessary Methods
 ---------------------------
 
 In the next steps we implement all necessary methods which are needed to make
-the criterion work.
+the criterion work. In this case these are ``get_operators`` and ``is_valid``.
 
 The ``get_operators`` method needs to return the available operators for this
 criterion. It is a list of list, whereas the first value is an integer and the
         request
             The current request.
 
-Please see also the example application :download:`product_criterion
-<product_criterion.tar.gz>` for the complete implementation of the model.
-
 Plug in the Criterion
 =====================
 
 
 #. Add your application to settings.INSTALLED_APPS and sync your database::
 
-    INSTALLED_APPS = (
-        ...
-        "product_criterion",
-    )
+     INSTALLED_APPS = (
+          ...
+          "product_criterion",
+     )
 
 #. Add the class to the :ref:`LFS_CRITERIA <settings_lfs_criteria>` setting::
 
-    LFS_CRITERIA = [
-        ...
-        ["product_criterion.models.CartPriceCriterion", _(u"Product Criterion")],
-    ]
+     LFS_CRITERIA = [
+         ...
+         ["product_criterion.models.ProductCriterion", _(u"Product Criterion")],
+     ]
 
 #. As all criteria are models, you have to synchronize your database::
 
-    $ bin/django syncdb
+     $ bin/django syncdb
 
 #. Restart your instance and the criterion should be available for selection,
    for instance within the discount criteria tab.

docs/developer/howtos/how_to_integrate_localized_version_of_tinymce.rst

 LFS ships with main package of TinyMCE that doesn't contain any translation files.
 It is easy to use internationalized version of TinyMCE by adding few things into your theme.
 
-
 Steps
 -----
 
-1. Download TinyMCE
+#. Download TinyMCE
 
-    Go to TinyMCE website and `download <http://www.tinymce.com/download/download.php>`_ ``TinyMCE x.x jQuery package``
+   Go to TinyMCE website and `download TinyMCE x.x jQuery package <http://www.tinymce.com/download/download.php>`_
 
-2. Extract TinyMCE into your ``theme``
+#. Extract TinyMCE into your ``theme``
 
-    Extract downloaded ``TinyMCE`` into your :doc:`Theme </developer/howtos/theme/index>`, e.g. ``theme/static/manage/tiny_mce_x_x/``
+   Extract downloaded ``TinyMCE`` into your :doc:`Theme </developer/howtos/theme/index>`, e.g. ``theme/static/manage/tiny_mce_x_x/``
 
-3. Download TinyMCE language file(s)
+#. Download TinyMCE language file(s)
 
-    Go to TinyMCE website and `download <http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download&pr_id=1>`_ language file(s) that you need
+   Go to TinyMCE website and `download language file(s) <http://www.tinymce.com/i18n/index.php?ctrl=lang&act=download&pr_id=1>`_ that you need
 
-4. Extract TinyMCE language files into your ``theme``
+#. Extract TinyMCE language files into your ``theme``
 
-    Go to folder where you've just extracted main package of TinyMCE, e.g.: ``theme/static/manage/tiny_mce_x_x/``
-    and extract language files into proper directories.
+   Go to folder where you've just extracted main package of TinyMCE, e.g.: ``theme/static/manage/tiny_mce_x_x/``
+   and extract language files into proper directories.
 
-5. Copy ``manage_base.html`` to your theme
+#. Copy ``manage_base.html`` to your theme
 
-    Copy ``lfs/templates/manage/manage_base.html`` to your theme: ``mytheme/templates/manage/manage_base.html``
+   Copy ``lfs/templates/manage/manage_base.html`` to your theme: ``mytheme/templates/manage/manage_base.html``
 
-5. Copy ``lfs_tinymce.js`` to your theme
+#. Copy ``lfs_tinymce.js`` to your theme
 
-    Copy ``lfs/static/js/lfs_tinymce.js`` to your theme: ``mytheme/static/js/lfs_tinymce.js``
-    (if you use different path then you have to update it at manage_base.html in step 7)
+   Copy ``lfs/static/js/lfs_tinymce.js`` to your theme: ``mytheme/static/js/lfs_tinymce.js``
+   (if you use different path then you have to update it at manage_base.html in step 7)
 
-6. Modify ``lfs_tinymce.js`` (copy located at your theme)
+#. Modify ``lfs_tinymce.js`` (copy located at your theme)
 
-    Change/add highlighted parts of TinyMCE initialization script:
+   Change/add highlighted parts of TinyMCE initialization script:
 
-    .. code-block:: javascript
-      :emphasize-lines: 4,20
+   .. code-block:: javascript
+     :emphasize-lines: 4,20
 
-      // Theme options
-      $(selector).tinymce({
-          // Location of TinyMCE script
-          script_url : '/static/manage/tiny_mce_x_x/tiny_mce.js',
+     // Theme options
+     $(selector).tinymce({
+         // Location of TinyMCE script
+         script_url : '/static/manage/tiny_mce_x_x/tiny_mce.js',
 
-          // General options
-          theme : "advanced",
-          plugins : "safari,save,iespell,directionality,fullscreen,xhtmlxtras,media",
+         // General options
+         theme : "advanced",
+         plugins : "safari,save,iespell,directionality,fullscreen,xhtmlxtras,media",
 
-          theme_advanced_buttons1 : buttons,
-          theme_advanced_buttons2 : "",
-          theme_advanced_buttons3 : "",
-          theme_advanced_buttons4 : "",
-          theme_advanced_toolbar_location : "top",
-          theme_advanced_toolbar_align : "left",
-          save_onsavecallback : "save",
-          relative_urls : false,
-          cleanup : false,
-          height : height,
-          language : LFS_LANGUAGE,
-          content_css : "/static/css/tinymce_styles.css",
-          setup : function(ed) {
-              ed.addButton('image', {
-                  onclick : function(e) {
-                      imagebrowser(e, ed);
-                  }
-              });
-          }
-      });
+         theme_advanced_buttons1 : buttons,
+         theme_advanced_buttons2 : "",
+         theme_advanced_buttons3 : "",
+         theme_advanced_buttons4 : "",
+         theme_advanced_toolbar_location : "top",
+         theme_advanced_toolbar_align : "left",
+         save_onsavecallback : "save",
+         relative_urls : false,
+         cleanup : false,
+         height : height,
+         language : LFS_LANGUAGE,
+         content_css : "/static/css/tinymce_styles.css",
+         setup : function(ed) {
+             ed.addButton('image', {
+                 onclick : function(e) {
+                     imagebrowser(e, ed);
+                 }
+             });
+         }
+     });
 
-7. Customize ``manage_base.html`` at your theme
+#. Customize ``manage_base.html`` at your theme
 
    Replace:
 
-     .. code-block:: html
+   .. code-block:: html
 
-       <script type="text/javascript" src="{{ STATIC_URL }}tiny_mce-3.4.2/jquery.tinymce.js"></script>
+     <script type="text/javascript" src="{{ STATIC_URL }}tiny_mce-3.4.2/jquery.tinymce.js"></script>
 
    with (use path to TinyMCE folder that you created in step 2):
 
-     .. code-block:: html
+   .. code-block:: html
 
-       <script type="text/javascript" src="{{ STATIC_URL }}manage/tiny_mce_x_x/jquery.tinymce.js"></script>
+     <script type="text/javascript" src="{{ STATIC_URL }}manage/tiny_mce_x_x/jquery.tinymce.js"></script>
 
    Add following code to <head> section:
 
-     .. code-block:: html
+   .. code-block:: html
 
-         <script type="text/javascript">
-           var LFS_LANGUAGE = '{{ LANGUAGE_CODE|lower }}';
-         </script>
+     <script type="text/javascript">
+       var LFS_LANGUAGE = '{{ LANGUAGE_CODE|lower }}';
+     </script>
 
    Note that for some languages ``LANGUAGE_CODE`` used by Django may differ from language code used by TinyMCE.
    For such cases you'll probably have to write your own tag/filter that will map Django's language code to TinyMCE's

docs/glossary.rst

         LFS is distributed under the BSD-License, which is a permissive free
         software license. See also: http://en.wikipedia.org/wiki/BSD_licenses
 
+    Django
+        The web framework LFS is build upon. See http://www.djangoproject.com.
+
     LMI
         Acronym for LFS Management Interface. See also :term:`MI`.
 
     Portlets
         A portlet is a piece of content which are managed in :term:`Slots`.
 
+    Shop customer
+        The person who buys goods from the shop.
+
+    Shop manager
+        The person who puts content into shop, like products, categories,
+        shipping methods and that like.
+
+    Shop owner
+        The person who sells goods within the shop.
+
     Slot
     Slots
         Slots are display left and right beside the main content.
     WYSIWYG
         Acronym for ``What You See Is What You Get``. See also:
         http://en.wikipedia.org/wiki/WYSIWYG.
-
-

docs/user/management/catalog/products.rst

 
     Available tokens::
 
-    product(<attribute>)
-        Refers to the attribute of the current product
+        product(<attribute>)
+            Refers to the attribute of the current product
 
-    property(<id>)
-        Refers to the value of the property with the given <id>
+        property(<id>)
+            Refers to the value of the property with the given <id>
 
     Example 1::
 

lfs/criteria/models.py

 
     **Attributes:**
 
-        cart
-            The current cart of the current customer.
+    cart
+        The current cart of the current customer.
 
-        content
-            The content object the criterion belongs to.
+    content
+        The content object the criterion belongs to.
 
-        operator
-            The current selected operator for the criterion.
+    operator
+        The current selected operator for the criterion.
 
-        position
-            The position of the criterion within a list of criteria of the
-            content object.
+    position
+        The position of the criterion within a list of criteria of the
+        content object.
 
-        product
-            The product, if the criterion is called from a product detail view.
-            Otherwise this is None.
+    product
+        The product, if the criterion is called from a product detail view.
+        Otherwise this is None.
 
-        request
-            The current request.
+    request
+        The current request.
 
     **Constants:**
 
-        EQUAL, LESS_THAN, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL, IS_SELECTED, IS_NOT_SELECTED, IS_VALID, IS_NOT_VALID, CONTAINS
-            Integers which represents certain operators.
+    EQUAL, LESS_THAN, LESS_THAN_EQUAL, GREATER_THAN, GREATER_THAN_EQUAL, IS_SELECTED, IS_NOT_SELECTED, IS_VALID, IS_NOT_VALID, CONTAINS
+        Integers which represents certain operators.
 
-        INPUT, SELECT, MULTIPLE_SELECT
-            Constants which represents the types of selectable values. One of
-            these must be returned from ``get_value_type``.
+    INPUT, SELECT, MULTIPLE_SELECT
+        Constants which represents the types of selectable values. One of
+        these must be returned from ``get_value_type``.
 
-        NUMBER_OPERATORS
-            A list of operators which can be returned from ``get_operators``.
+    NUMBER_OPERATORS
+        A list of operators which can be returned from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [EQUAL, _(u"Equal to")],
-                    [LESS_THAN, _(u"Less than")],
-                    [LESS_THAN_EQUAL, _(u"Less than equal to")],
-                    [GREATER_THAN, _(u"Greater than")],
-                    [GREATER_THAN_EQUAL, _(u"Greater than equal to")],
-                ]
+            [
+                [EQUAL, _(u"Equal to")],
+                [LESS_THAN, _(u"Less than")],
+                [LESS_THAN_EQUAL, _(u"Less than equal to")],
+                [GREATER_THAN, _(u"Greater than")],
+                [GREATER_THAN_EQUAL, _(u"Greater than equal to")],
+            ]
 
 
-        SELECTION_OPERATORS
-            A list of operators which can be returned from ``get_operators``.
+    SELECTION_OPERATORS
+        A list of operators which can be returned from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [IS_SELECTED, _(u"Is selected")],
-                    [IS_NOT_SELECTED, _(u"Is not selected")],
-                ]
+            [
+                [IS_SELECTED, _(u"Is selected")],
+                [IS_NOT_SELECTED, _(u"Is not selected")],
+            ]
 
-        VALID_OPERATORS
-            A list of operators which can be returned from ``get_operators``.
+    VALID_OPERATORS
+        A list of operators which can be returned from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [IS_VALID, _(u"Is valid")],
-                    [IS_NOT_VALID, _(u"Is not valid")],
-                ]
+            [
+                [IS_VALID, _(u"Is valid")],
+                [IS_NOT_VALID, _(u"Is not valid")],
+            ]
 
-        STRING_OPERATORS
-            A list of operators which can be return from ``get_operators``.
+    STRING_OPERATORS
+        A list of operators which can be return from ``get_operators``.
 
-            .. code-block:: python
+        .. code-block:: python
 
-                [
-                    [EQUAL, _(u"Equal to")],
-                    [CONTAINS, _(u"Contains")],
-                ]
+            [
+                [EQUAL, _(u"Equal to")],
+                [CONTAINS, _(u"Contains")],
+            ]
     """
     content_type = models.ForeignKey(ContentType, verbose_name=_(u"Content type"), related_name="content_type")
     content_id = models.PositiveIntegerField(_(u"Content id"))
 
     def is_valid(self):
         """
-        If product is given the weigth is taken from the product, otherwise it
+        If product is given, the price is taken from the product, otherwise it
         is the total price of all products within the cart.
         """
         if self.product:
 
     def is_valid(self):
         """
-        If product is given the clag is taken from the product, otherwise it
-        is the clag of all products within the cart.
+        If product is given, the clag is taken from the product, otherwise it is
+        the clag of all products within the cart.
         """
         if self.product:
             clag = (2 * self.product.get_width()) + (2 * self.product.get_height()) + self.product.get_length()
 
     def is_valid(self):
         """
-        If product is given the weigth is taken from the product, otherwise it
+        If product is given, the height is taken from the product, otherwise it
         is the total height of all products within the cart.
         """
         if self.product:
 
     def is_valid(self):
         """
-        If product is given the length is taken from the product otherwise it
+        If product is given, the length is taken from the product otherwise it
         is the max length of all products within the cart.
         """
         if self.product:
 
     def is_valid(self):
         """
-        If product is given the weigth is taken from the product, otherwise it
+        If product is given, the weigth is taken from the product, otherwise it
         is the total weight of all products within the cart.
         """
         if self.product:
 
     def is_valid(self):
         """
-        If product is given the width is taken from the product, otherwise it
+        If product is given, the width is taken from the product, otherwise it
         is the max width of all products within the cart.
         """
         if self.product:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.