<commit_before>Changlist Forms
===============

.. currentmodule:: betterforms.changelist

**Changlist Forms** are designed to facilitate easy searching and sorting on
django models, along with providing a framework for building other
functionality that deals with operations on lists of model instances.


.. class:: ChangeListForm

    Base form class for all **Changlist** forms.

    * setting the queryset:

      All changelist forms need to *know* what queryset to begin with.  You can
      do this by either passing a named keyword parameter into the contructor of
      the form, or by defining a model attribute on the class.


.. class:: SearchForm

    Form class which facilitates searching across a set of specified fields for
    a model.  This form adds a field to the model ``q`` for the search query.

   .. attribute:: SEARCH_FIELDS
    
     The list of fields that will be searched against.

   .. attribute:: CASE_SENSITIVE

     Whether the search should be case sensitive.


    Here is a simple :class:`SearchForm` example for searching across users.

    .. code-block:: python

       # my_app/forms.py
       from django.contrib.auth.models import get_user_model
       from betterforms.forms import SearchForm

       class UserSearchForm(SearchForm):<commit_msg>Fixed Changlist typo.<commit_after>Changelist Forms
================

.. currentmodule:: betterforms.changelist

**Changelist Forms** are designed to facilitate easy searching and sorting on
django models, along with providing a framework for building other
functionality that deals with operations on lists of model instances.


.. class:: ChangeListForm

    Base form class for all **Changelist** forms.

    * setting the queryset:

      All changelist forms need to *know* what queryset to begin with.  You can
      do this by either passing a named keyword parameter into the contructor of
      the form, or by defining a model attribute on the class.


.. class:: SearchForm

    Form class which facilitates searching across a set of specified fields for
    a model.  This form adds a field to the model ``q`` for the search query.

   .. attribute:: SEARCH_FIELDS
    
     The list of fields that will be searched against.

   .. attribute:: CASE_SENSITIVE

     Whether the search should be case sensitive.


    Here is a simple :class:`SearchForm` example for searching across users.

    .. code-block:: python

       # my_app/forms.py
       from django.contrib.auth.models import get_user_model
       from betterforms.forms import SearchForm

       class UserSearchForm(SearchForm):
{'fraction_non_alphanumeric': 0.06620477290223249, 'fraction_numerical': 0.0, 'mean_word_length': 3.246732026143791, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '467158', 'n_tokens_mistral': 673, 'n_tokens_neox': 628, 'n_words': 313}