PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  ]c@sdZddlZddlZddlZddlmZmZddlmZddl m Z ddl m Z m Z mZmZmZddlmZmZmZddlmZdd lmZdd lmZdd lmZdd lmZdd lm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*m+Z+ddl,m-Z-dZ.ej/Z/de0fdYZ1de1fdYZ2de1fdYZ3de1fdYZ4de1fdYZ5de0fdYZ6d e7fd!YZ8d"e%j9e8fd#YZ:d$e0fd%YZ;d&e0fd'YZ<e=d(Z>d)Z?d*Z@d+ZAd,e0fd-YZBd.ZCdS(/sM The main QuerySet implementation. This provides the public API for the ORM. iN(t OrderedDicttdeque(tsettings(t exceptions(tDJANGO_VERSION_PICKLE_KEYtIntegrityErrort connectionstroutert transaction(t DateFieldt DateTimeFieldtsql(t LOOKUP_SEP(t Collector(tF(t AutoField(tTrunc(t InvalidQuerytQ(tCURSOR(tsixttimezone(tRemovedInDjango20Warning(tcached_propertyt partition(t get_versionit BaseIterablecBseZedZRS(cCs||_||_dS(N(tquerysett chunked_fetch(tselfRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__init__%s (t__name__t __module__tFalseR(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR$st ModelIterablecBseZdZdZRS(s= Iterable that yields a model instance for each row. ccs|j}|j}|jjd|}|jd|j}|j|j|j}}}|d}|d} | d| dd} } g|| | !D]} | dj j ^q} t |||}x-|j |D]}|j || || | !}|rx!|D]}|j||qWn|rXx1|jD] \}}t||||q1Wn|jrx|jjD]q\}}t||jrqqnt||j}y||}Wntk rqqXt||j|qqWn|VqWdS(NtusingRtmodelt select_fieldsiii(Rtdbtqueryt get_compilert execute_sqlRtselectt klass_infotannotation_col_mapttargettattnametget_related_populatorst results_itertfrom_dbtpopulatetitemstsetattrt_known_related_objectsthasattrtget_cache_nametgetattrt get_attnametKeyErrortname(RRR&tcompilertresultsR*R+R,t model_clsR%tmodel_fields_starttmodel_fields_endtft init_listtrelated_populatorstrowtobjt rel_populatort attr_nametcol_postfieldtrel_objstpktrel_obj((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__iter__/s>     '   (RR t__doc__RM(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR"*stValuesIterablecBseZdZdZRS(sU Iterable returned by QuerySet.values() that yields a dict for each row. c cs|j}|j}|j|j}t|j}t|j}t|j}|||}x1|jd|j D]}t t ||VquWdS(NR( RR'R(R&tlistt values_selectt extra_selecttannotation_selectR0Rtdicttzip( RRR'R<t field_namest extra_namestannotation_namestnamesRD((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRM^s  (RR RNRM(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyROXstValuesListIterablecBseZdZdZRS(se Iterable returned by QuerySet.values_list(flat=False) that yields a tuple for each row. c #s<|j}|j}|j|j}|j rf|j rfx|jd|jD]}t|VqNWnt |j }t |j}t |j}|||}|j rt |j g|D]} | |j kr| ^q} n|} xM|jd|jD]6}t t ||tfd| DVqWdS(NRc3s|]}|VqdS(N((t.0RA(tdata(s:/usr/lib/python2.7/site-packages/django/db/models/query.pys s(RR'R(R&RRRSR0RttupleRPRQt_fieldsRTRU( RRR'R<RDRVRWRXRYRAtfields((R\s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRMts    8(RR RNRM(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRZnstFlatValuesListIterablecBseZdZdZRS(s] Iterable returned by QuerySet.values_list(flat=True) that yields single values. ccsK|j}|jj|j}x&|jd|jD]}|dVq4WdS(NRi(RR'R(R&R0R(RRR<RD((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRMs (RR RNRM(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR`stQuerySetcBsteZdZdNdNdNdNdZdZee_eeZdZ dZ dZ dZ dZ dZd Zd Zd Zd Zd ZdZdZdZdZdZdZdNdZdNdZdNdZedZdZdNddZ dNdZ!dNdZ"dZ#dZ$dNdZ%d Z&ee&_'ee&_d!Z(ee(_'d"Z)ee)_'d#Z*ee*_'ee*_d$Z+d%Z,dNdNdNd&Z-d'Z.d(Z/d)Z0d*d+Z1d*dNd,Z2d-Z3d.Z4d/Z5d0Z6d1Z7d2Z8d3Z9d4Z:d5Z;d6Z<eed7Z=d8Z>d9Z?d:Z@d;ZAd<ZBdNdNdNdNdNdNd=ZCd>ZDd?ZEd@ZFdAZGeHdBZIeHdCZJeedNdDZKeeK_'eeK_dEZLdFZMdGZNdHZOdIZPdJZQdKZRdLZSdMZTRS(OsA Represents a lazy database lookup for a set of objects. cCs||_||_|pi|_|p6tj|j|_d|_t|_ t|_ d|_ t|_ i|_ t|_d|_dS(N((R$t_dbt_hintsR tQueryR'tNonet _result_cacheR!t_sticky_filtert _for_writet_prefetch_related_lookupst_prefetch_doneR5R"t_iterable_classR^(RR$R'R#thints((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs         cCs/ddlm}|j|}t|_|S(Ni(tManager(tdjango.db.models.managerRmt from_querysettTruet_built_with_as_manager(tclsRmtmanager((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt as_managers cCse|j}xR|jjD]A\}}|dkrDd|j|(RPtREPR_OUTPUT_SIZEtlenRuR(RR\((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__repr__s cCs|jt|jS(N(R}RRf(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__len__s cCs|jt|jS(s The queryset iterator protocol uses three nested iterators in the default case: 1. sql.compiler:execute_sql() - Returns 100 rows at time (constants.GET_ITERATOR_CHUNK_SIZE) using cursor.fetchmany(). This part is responsible for doing some column masking, and returning the rows in chunks. 2. sql/compiler.results_iter() - Returns one row at time. At this point the rows are still just tuples. In some cases the return values are converted to Python values at this location. 3. self.iterator() - Responsible for turning the rows into model objects. (R}titerRf(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRMs cCs|jt|jS(N(R}tboolRf(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__bool__s cCst|j|S(N(ttypeR(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt __nonzero__scCst|tftjs"tn|jdk r<|j|St|tr|j}|jdk rxt |j}nd}|j dk rt |j }nd}|j j |||j rt|dd|j S|S|j}|j j ||dt|dS(sE Retrieves an item or slice from the set of results. Nii(t isinstancetsliceRt integer_typest TypeErrorRfRet_clonetstarttinttstopR't set_limitststepRP(RRztqsRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt __getitem__s"   ' cCsi|j|t|tr |St|tr3|S|j}|j||jj|jtj|S(N( t_merge_sanity_checkRt EmptyQuerySetRt_merge_known_related_objectsR'tcombineR tAND(Rtothertcombined((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__and__#s   cCsi|j|t|tr |St|tr3|S|j}|j||jj|jtj|S(N( RRRRRR'RR tOR(RRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__or__.s   cCs3t|jjjd }t|j|d|S(sc An iterator over the results from applying this QuerySet to the database. tDISABLE_SERVER_SIDE_CURSORSR(RR&t settings_dictRRRk(Rtuse_chunked_fetch((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytiterator=scOs|jjrtdnxL|D]D}y |jWn#ttfk rXtdnX|||jsN(R$Rtget_parent_listtconcrete_modelt ValueErrorRpRhRR&tconcrete_fieldsRPRRtatomicR!Rt_batched_insertRRtfeaturestcan_return_ids_from_bulk_insertRURKt_statetadding( RRt batch_sizetparentt connectionR_t objs_with_pktobjs_without_pkRAtidstobj_without_pkRK((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt bulk_creates0    (   cKsc|j||\}}t|_y|j|tfSWn$|jjk r^|j||SXdS(s Looks up an object with the given kwargs, creating one if necessary. Returns a tuple of (object, created), where created is a boolean specifying whether an object was created. N(t_extract_model_paramsRpRhRR!R$Rt_create_object_from_params(RtdefaultsRtlookuptparams((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt get_or_creates  c Ks |p i}|j||\}}t|_tjd|jy|jj|}WnE|jj k r|j ||dt\}}|r||fSnXxBt j |D]1\}}t ||t|r|n|qW|jd|jWdQX|tfS(s Looks up an object with the given kwargs, updating one with defaults if it exists, otherwise creates a new one. Returns a tuple (object, created), where created is a boolean specifying whether an object was created. R#tlockN(RRpRhRRR&tselect_for_updateRR$RRRt iteritemsR4tcallableRR!( RRRRRREtcreatedRzR{((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytupdate_or_creates  )cCsyOtjd|j*d|jD}|j|}WdQX|tfSWnstk rtj}y/|r|j n|}|j |t fSWn|j j k rnXtj|nXdS(ss Tries to create an object using passed params. Used by get_or_create and update_or_create R#cSs4i|]*\}}t|r'|n||qS((R(R[RzR{((s:/usr/lib/python2.7/site-packages/django/db/models/query.pys s N(RRR&R3RRpRtsystexc_infoRRR!R$RRtreraise(RRRRRERR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs  c KsI|p i}|j}xB|jjjD]1}|j|kr(|j|j||j s s)Invalid field name(s) for model %s: '%s'.s', '(RwR$RR_R.tpopR;R3Rt_property_namest get_fieldRtFieldDoesNotExistR8tfsettappendt FieldErrorRtjointsorted( RRRRRARtproperty_namestinvalid_paramstparam((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs*     ! t-cCsq|pt|jjd}|j}|jjdd|jjdt|jjd||f|j S(s Returns the latest object, according to the model's 'get_latest_by' option or optional given field_name. t get_latest_bythighit force_emptys%s%s( R8R$RRR'Rtclear_orderingRpt add_orderingR(Rt field_namet directionRRE((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_earliest_or_latests  cCs|jd|ddS(NRRt(R(RR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytearliest-scCs|jd|ddS(NRRR(R(RR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytlatest0scCs:t|jr|n |jdd }|r6|dSdS(sY Returns the first object of a query, returns None if no match is found. RKiiN(RPtorderedRRe(Rtobjects((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytfirst3s(cCs@t|jr|jn |jdd }|r<|dSdS(sX Returns the last object of a query, returns None if no match is found. s-pkiiN(RPR treverseRRe(RR ((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytlast<s.cCsK|dk r1|siS|jd|j}n |j}d|DS(s Returns a dictionary mapping each of the given IDs to the object with that ID. If `id_list` isn't provided, the entire QuerySet is evaluated. tpk__incSsi|]}||jqS((t _get_pk_val(R[RE((s:/usr/lib/python2.7/site-packages/django/db/models/query.pys Rs N(ReRRR(Rtid_listR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytin_bulkEs   cCs|jdk rtdn|j}t|_t|j_t|j_ |jj dtt d|j }|j ||j\}}d|_||fS(s> Deletes the records in the current QuerySet. s6Cannot call delete() after .values() or .values_list()RR#N(R^ReRRRpRhR!R'Rtselect_relatedRR R&tcollecttdeleteRf(Rt del_queryt collectortdeletedt _rows_count((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRTs      cCstj|jj||S(s Deletes objects found from the given queryset in single direct SQL query. No signals are sent, and there is no protection for cascades. (R t DeleteQueryR$t delete_qs(RR#((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt _raw_deleteuscKs~t|_|jjtj}|j|d|_t j d|j dt  |j |j jt}WdQXd|_|S(s Updates all elements in the current QuerySet, setting all the given fields to the appropriate values. R#RN(RpRhR'RR t UpdateQuerytadd_update_valuesRet _annotationsRRR&R!R(R)RRf(RRR'trows((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR}s   ! cCsD|jjtj}|j|d|_|j|jj t S(s  A version of update that accepts field objects instead of field names. Used primarily for model saving and not intended for use by general code (it requires too much poking around at model internals to be useful at that level). N( R'RR Rtadd_update_fieldsReRfR(R&R)R(RtvaluesR'((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_updates   cCs2|jdkr%|jjd|jSt|jS(NR#(RfReR't has_resultsR&R(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytexistsscCs t|j|jt|_dS(N(tprefetch_related_objectsRfRiRpRj(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_prefetch_related_objectssc Cs=|dkr|j}nt|d|jd|d|d|S(NR$Rt translationsR#(ReR&t RawQuerySetR$(Rt raw_queryRR)R#((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytraws  cOsA|j}|r$|j|}n||_|jj||S(N(RtannotateR^R't set_values(RR_t expressionsR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_valuess   cOs/|t|7}|j||}t|_|S(N(R]R0RORk(RR_R/R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR#s c Os|jdt}|r4tdt|fn|r[t|dkr[tdng}i}xV|D]N}t|drtt|}|||<|j|qn|j|qnW|j ||}|rt nt |_ |S(Ntflats/Unexpected keyword arguments to values_list: %sisH'flat' is not valid when values_list is called with more than one field.tresolve_expression( RR!RRPRR6tstrtidRR0R`RZRk( RR_RR1R^R/RItfield_idR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt values_lists   tASCcCsn|jdt||dtdt|jddtjjdtj |dkrcdnddS( s Returns a list of date objects representing all available dates for the given field_name, scoped to 'kind'. t datefieldt output_fieldt plain_fieldR1tplain_field__isnulltDESCRR( R-RR RR6RptdistinctRR!R(RRtkindtorder((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytdatess c Cstjr'|d kr-tj}q-nd }|jdt||dtd|dt|j ddt j j dt j|dkrdnd dS( s Returns a list of datetime objects representing all available datetimes for the given field_name, scoped to 'kind'. t datetimefieldR9ttzinfoR:R1R;R<RRN(RtUSE_TZReRtget_current_timezoneR-RR RR6RpR=RR!R(RRR>R?RB((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt datetimess   cCs|j}|jj|S(s, Returns an empty QuerySet. (RR't set_empty(RR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytnones  cCs |jS(s Returns a new QuerySet that is a copy of the current one. This allows a QuerySet to proxy for a model manager in some cases. (R(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytallscOs|jt||S(sb Returns a new QuerySet instance with the args ANDed to the existing set. (t_filter_or_excludeR!(RRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRscOs|jt||S(sd Returns a new QuerySet instance with NOT (args) ANDed to the existing set. (RIRp(RRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytexcludescOs[|s|rn|j}|r>|jjt||n|jjt|||S(N(RR'tadd_qR(RtnegateRRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRIs  cCsRt|tst|dr>|j}|jj||S|jd|SdS(so Returns a new QuerySet instance with filter_obj added to the filters. filter_obj can be a Q object (or anything with an add_to_query() method) or a dictionary of keyword lookup arguments. This exists to support framework features such as 'limit_choices_to', and usually it will be more natural to use other methods. t add_to_queryN(RRR6RR'RKRIRe(Rt filter_objR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytcomplex_filter(s  cOsw|j}|jjt|jj|jftd|D|j_||j_|jdt |j_ |S(Ncss|]}|jVqdS(N(R'(R[R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pys ?sRH( RR'RRpt clear_limitsR]tcombined_queriest combinatorRR!tcombinator_all(RRRtother_qsRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_combinator_query9s  & cOs|rDtd|jDd}|rDtd|fqDnt|trg|D]}t|tsZ|^qZ}|r|djd|d|S|S|jd||S(Ncss!|]}|dkr|VqdS(RHN((R[Rz((s:/usr/lib/python2.7/site-packages/django/db/models/query.pys Fss4union() received an unexpected keyword argument '%s'itunioni(tnextRReRRRRU(RRTRtunexpected_kwargtqR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRVDs(%cGsGt|tr|Sx!|D]}t|tr|SqW|jd|S(Nt intersection(RRRU(RRTR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRZRs  cGs#t|tr|S|jd|S(Nt difference(RRRU(RRT((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR[[scCsX|r|rtdn|j}t|_t|j_||j_||j_|S(sj Returns a new QuerySet instance that will select objects with a FOR UPDATE lock. s2The nowait option cannot be used with skip_locked.(RRRpRhR'Rtselect_for_update_nowaittselect_for_update_skip_locked(Rtnowaitt skip_lockedRE((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRas      cGsn|jdk rtdn|j}|dkrEt|j_n%|r^|jj|n t|j_|S(s Returns a new QuerySet instance that will select related objects. If fields are specified, they must be ForeignKey fields and only those related objects are included in the selection. If select_related(None) is called, the list is cleared. s>Cannot call select_related() after .values() or .values_list()N(N( R^ReRRR!R'Rtadd_select_relatedRp(RR_RE((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRos    cGs8|j}|dkr$d|_n|j||_|S(sd Returns a new QuerySet instance that will prefetch the specified Many-To-One and Many-To-Many related objects when the QuerySet is evaluated. When prefetch_related() is called more than once, the list of lookups to prefetch is appended to. If prefetch_related(None) is called, the list is cleared. N(N((RReRi(RtlookupsR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytprefetch_relateds   c Ost}xj|D]b}y)|j|kr>td|jnWn#ttfk rdtdnX|||js s8The annotation '%s' conflicts with a field on the model.RN(RRRRRRRR^ReR$Rt get_fieldsR3R'RR!RRRptgroup_byt set_group_by( RRRRRRRYRt annotation((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR-s4         cGs3|j}|jjdt|jj||S(sL Returns a new QuerySet instance with the ordering changed. R(RR'RR!R(RRVRE((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs cGs |j}|jj||S(sY Returns a new QuerySet instance that will select only distinct results. (RR'tadd_distinct_fields(RRVRE((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR=s cCs/|j}|jj|||||||S(s8 Adds extra SQL fragments to the query. (RR't add_extra(RR*twhereRttablesRt select_paramsR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytextras cCs#|j}|jj |j_|S(s8 Reverses the ordering of the QuerySet. (RR'tstandard_ordering(RR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs cGsZ|jdk rtdn|j}|dkrF|jjn|jj||S(sU Defers the loading of data for certain fields until they are accessed. The set of fields to defer is added to any existing set of deferred fields. The only exception to this is if None is passed in as the only parameter, in which case all deferrals are removed (None acts as a reset option). s5Cannot call defer() after .values() or .values_list()N(N(R^ReRRR'tclear_deferred_loadingtadd_deferred_loading(RR_R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytdefers  cGsY|jdk rtdn|dkr9tdn|j}|jj||S(s Essentially, the opposite of defer. Only the fields passed into this method and that are not already specified as deferred are loaded immediately when the queryset is evaluated. s4Cannot call only() after .values() or .values_list()s*Cannot pass None as an argument to only().N(N(R^ReRRR'tadd_immediate_loading(RR_R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytonlys  cCs|j}||_|S(sX Selects which database this QuerySet should execute its query against. (RRb(RRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR# s  cCsF|jjs|jjrtS|jjr>|jjjr>tStSdS(s Returns True if the QuerySet is ordered -- i.e. has an order_by() clause or a default ordering on the model. N(R'textra_order_byRRptdefault_orderingtget_metatorderingR!(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR s cCsG|jr(|jp'tj|j|jS|jpFtj|j|jS(sCReturn the database that will be used if this query is executed now(RhRbRt db_for_writeR$Rct db_for_read(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR&"s cCsbt|_|dkr!|j}ntj|j}|j||d||jd|j |S(s Inserts a new record for the given model. This provides an interface to the InsertQuery class and is how Model.save() is implemented. R,R#N( RpRhReR&R t InsertQueryR$t insert_valuesR(R)(RRR_t return_idR,R#R'((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_insert-s    c Cs|s dSt|jj}|p8t|j||d}g}xgtdt||D]}||||!^q]D]}t|jjjr|j |d|d|jdt }t |t r|j |q|j|qx|j |d|d|jqxW|S(s A little helper method for bulk_insert to insert the bulk one batch at a time. Inserts recursively a batch from the front of the bulk and then _batched_insert() the remaining objects again. NiiR_R#R{(RR&topstmaxtbulk_batch_sizetrangeRRRR|RpRRPtextendR( RRR_RR}t inserted_idstititemt inserted_id((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR;s!=$ c Ks|jj}|jr$t|_n|jd|jd|d|jd|j}|j |_ |j |_ |j |_ |j |_ |j |_ |jj||S(NR$R'R#Rl(R'RRgRptfilter_is_stickyRuR$RbRcRhRiR5RkR^RvR(RRR'R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRQs  -     cCsN|jdkr*t|j||_n|jrJ|j rJ|jndS(N(RfReRPRkRiRjR((R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR}_scCs t|_|S(s Indicates that the next filter call and the one following that should be treated as a single filter. This is only important when it comes to determining when to reuse tables for many-to-many filters. Required so that we can filter naturally on the results of related managers. This doesn't return a clone of the current QuerySet (it returns "self"). The method is only used internally and should be immediately followed by a filter() that does create a clone. (RpRg(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_next_is_stickyes cCs|jdk rt|jjt|jjks{t|jjt|jjks{t|jjt|jjkrtd|jj ndS(sM Checks that we are merging two comparable QuerySet classes. s?Merging '%s' classes must involve the same values in each case.N( R^RetsetR'RQRRRSRRuR(RR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRss$$$cCs@x9|jjD](\}}|jj|ij|qWdS(sX Keep track of all known related objects from either QuerySet instance. N(R5R3t setdefaultR(RRRIR ((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRscCsp|jdkr-|jd}t|j_n0t|jdkrQtdn|j}|jj |j S(NRKis0Cannot use multi-field values as a filter value.( R^ReR#RpR't _forced_pkRRRtas_subquery_filterRb(RR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt_prepare_as_filter_values cKs|jj|dS(sE Update hinting information for later use by Routers N(RcR(RRl((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt _add_hintsscCs |jjS(s Checks if this QuerySet has any filtering going on. Note that this isn't equivalent for checking if all objects are present in results, for example qs[1:]._has_filters() -> False. (R't has_filters(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt _has_filterssN(URR RNReRRtRpt queryset_onlyt classmethodR|RRRRRMRRRRRRRRRRRRRRR!RRRR R R RRRt alters_dataRRR$R&R(R,R0R#R6R@RERGRHRRJRIRORURVRZR[RRRbR-RR=RlRRpRrR#tpropertyR R&R|RRR}RRRRRR(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRas                 3                               *               tInstanceCheckMetacBseZdZRS(cCst|to|jjS(N(RRaR'tis_empty(Rtinstance((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyt__instancecheck__s(RR R(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRsRcBseZdZdZRS(s Marker class usable for checking if a queryset is empty by .none(): isinstance(qs.none(), EmptyQuerySet) -> True cOstddS(Ns#EmptyQuerySet can't be instantiated(R(RRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs(RR RNR(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRsR*cBseZdZd d d d d d dZdZdZdZdZe dZ dZ e dZ e d ZRS( sp Provides an iterator which converts the results of raw SQL queries into annotated model instances. c Csv||_||_||_|p$i|_|pNtjd|d|jd||_|p]d|_|pli|_ dS(NR R#R(( R+R$RbRcR tRawQueryR&R'RR)(RR+R$R'RR)R#Rl((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs   *cCsg|jjjD]}|j|jkr|^q}gt|jD]'\}}||jkrD||f^qD}g|D]}|jj|j^qx}g|D]}|j^q}|||fS(sB Resolve the init field names and value positions ( R$RR_tcolumntcolumnst enumeratet model_fieldstindexR.(RRAtmodel_init_fieldstposRtannotation_fieldstmodel_init_ordertmodel_init_names((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytresolve_model_init_orders 4!(ccs|j}t|jjd|jt||}t|j}z|j\}}}t}x9|jj j D](}|j |krr|j |j qrqrW|r|jj j j |krtdqn|j} g|jD]} |jj| ^q} |jg| D]*} | r0| j| jj jnd^q } x|D]}| rg|j|| }ng|D]}||^qn}| j|||}|rx+|D] \}}t||||qWn|VqFWWdt|jdr |jjr |jjjnXdS(Nt SQLCompilers&Raw query must include the primary keytcursor(R&RR}R<R'RRRR$RR_R.taddRKRRRRtget_converterstget_coltdb_tableRetapply_convertersR1R4R6Rtclose(RR&R<R'Rtmodel_init_posRtskipRIR>tcR_RAt convertersR#Rtmodel_init_valuesRR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRMs8   (:  cCsd|jj|jfS(Ns<%s: %s>(RuRR'(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRscCst||S(N(RP(RRz((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRscCs|jptj|j|jS(sCReturn the database that will be used if this query is executed now(RbRRxR$Rc(R((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR&sc CsCt|jd|jd|jjd|d|jd|jd|S(s\ Selects which database this Raw QuerySet should execute its query against. R$R'R#RR)(R*R+R$R'RRR)(RR((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR#s cCsd|jj}xN|jjD]=\}}y|j|}|||RKtpk_idxR/RCtreverse_cache_namet remote_fieldR7Rtunique(RR+R*R&R%RRAtmodel_init_attnamest reorder_maptidxRItinit_posR{t_RRR((Rs:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs>    3 &   "  !    cCs|jr|j|}n||j|j!}||jdkrJd}n|jj|j|j|}|r|j rx$|j D]}|j ||qWnt ||j ||r|j rt ||j |ndS(N(RRRRReR>R1R&RBRCR2R4RR(RRDtfrom_objtobj_dataREtrel_iter((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR2s  (RR RNRR2(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyRs AcCsLg}|jdg}x-|D]%}t|||}|j|qW|S(Ntrelated_klass_infos(RRR(R+R*R&t iteratorsR trel_klass_infotrel_cls((s:/usr/lib/python2.7/site-packages/django/db/models/query.pyR/s  (DRNRwRRt collectionsRRt django.confRt django.coreRt django.dbRRRRRtdjango.db.modelsR R R tdjango.db.models.constantsR tdjango.db.models.deletionR tdjango.db.models.expressionsRtdjango.db.models.fieldsRtdjango.db.models.functionsRtdjango.db.models.query_utilsRRtdjango.db.models.sql.constantsRt django.utilsRRtdjango.utils.deprecationRtdjango.utils.functionalRRtdjango.utils.versionRRtEmptyResultSettobjectRR"RORZR`RaRRtwith_metaclassRR*RReRR'RRRR/(((s:/usr/lib/python2.7/site-packages/django/db/models/query.pytsR   ( .!   v3  / fa