ó
øĒTQc           @   sš   d  Z  d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d	 e f d
     YZ d e f d     YZ d e f d     YZ d e f d     YZ	 d S(   s>   
Classes to represent the definitions of aggregate functions.
t	   Aggregatec           B   s5   e  Z d  Z d   Z d   Z e e  Z d   Z RS(   s'   
    Default Aggregate definition.
    c         K   s   | |  _  | |  _ d S(   s6  Instantiate a new aggregate.

         * lookup is the field on which the aggregate operates.
         * extra is a dictionary of additional data to provide for the
           aggregate definition

        Also utilizes the class variables:
         * name, the identifier for this aggregate function.
        N(   t   lookupt   extra(   t   selfR   R   (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyt   __init__	   s    
	c         C   s   d |  j  |  j j   f S(   Ns   %s__%s(   R   t   namet   lower(   R   (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyt   _default_alias   s    c         C   sD   t  | j |  j  } | | d | d | |  j } | | j | <d S(   s=  Add the aggregate to the nominated query.

        This method is used to convert the generic Aggregate definition into a
        backend-specific definition.

         * query is the backend-specific query instance to which the aggregate
           is to be added.
         * col is a column reference describing the subject field
           of the aggregate. It can be an alias, or a tuple describing
           a table and column name.
         * source is the underlying field or aggregate definition for
           the column reference. If the aggregate is not an ordinal or
           computed type, this reference is used to determine the coerced
           output type of the aggregate.
         * is_summary is a boolean that is set True if the aggregate is a
           summary value rather than an annotation.
        t   sourcet
   is_summaryN(   t   getattrt   aggregates_moduleR   R   t
   aggregates(   R   t   queryt   aliast   colR   R	   t   klasst	   aggregate(    (    s4   ../Django//lib/python/django/db/models/aggregates.pyt   add_to_query   s    (   t   __name__t
   __module__t   __doc__R   R   t   propertyt   default_aliasR   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR       s
   		t   Avgc           B   s   e  Z d  Z RS(   R   (   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR   0   s   t   Countc           B   s   e  Z d  Z RS(   R   (   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR   3   s   t   Maxc           B   s   e  Z d  Z RS(   R   (   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR   6   s   t   Minc           B   s   e  Z d  Z RS(   R   (   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR   9   s   t   StdDevc           B   s   e  Z d  Z RS(   R   (   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR   <   s   t   Sumc           B   s   e  Z d  Z RS(   R   (   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR   ?   s   t   Variancec           B   s   e  Z d  Z RS(   R   (   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyR   B   s   N(
   R   t   objectR    R   R   R   R   R   R   R   (    (    (    s4   ../Django//lib/python/django/db/models/aggregates.pyt   <module>   s   +