https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /proc/self/root/lib/python2.7/site-packages/south/creator/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/lib/python2.7/site-packages/south/creator/actions.pyc
�
��Rc@s�dZddlmZddlZddlmZddlmZmZm	Z	m
Z
ddlmZddl
mZmZddlmZdd	lmZd
efd��YZdefd
��YZdefd��YZdefd��YZdeefd��YZdefd��YZdeefd��YZdefd��YZdefd��YZdefd��YZdefd��YZd efd!��YZ d"e fd#��YZ!dS($s�
Actions - things like 'a model was removed' or 'a field was changed'.
Each one has a class, which can take the action description and insert code
blocks into the forwards() and backwards() methods, in the right place.
i����(tprint_functionN(tRECURSIVE_RELATIONSHIP_CONSTANT(tFieldDoesNotExisttNOT_PROVIDEDt	CharFieldt	TextField(tvalue_clean(tremove_useless_attributest	model_key(tdatetime_utils(t	raw_inputtActioncBseeZdZeZeZd�Zd�Zd�Zd�Z	d�Z
ed��Zed��Z
RS(s�
    Generic base Action class. Contains utility methods for inserting into
    the forwards() and backwards() method lists.
    cCs
t�dS(N(tNotImplementedError(tself((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyt
forwards_codescCs
t�dS(N(R(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pytbackwards_code scCs9|jr"|jd|j��n|j|j��dS(Ni(tprepend_forwardstinsertRtappend(R
tforwards((s9/usr/lib/python2.7/site-packages/south/creator/actions.pytadd_forwards#s	cCs9|jr"|jd|j��n|j|j��dS(Ni(tprepend_backwardsRRR(R
t	backwards((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyt
add_backwards)s	cCs
t�dS(sEReturns the string to print on the console, e.g. ' + Added field foo'N(R(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pytconsole_line/scCs4x-|j�D]\}}|j|�||<q
W|S(N(titemst
triple_to_def(tclstfieldstfieldttriple((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyttriples_to_defs3sc	CsPd|ddj|dg|dj�D]\}}d||f^q(�fS(s(Turns a single triple into a definition.sself.gf(%r)(%s)is, iis%s=%s(tjoinR(RRtkwdtval((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR:s(t__name__t
__module__t__doc__tFalseRRRRRRRtclassmethodRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRs					tAddModelcBsNeZdZdddZdddZd�Zd�Zd�Zd�ZRS(	sN
    Addition of a model. Takes the Model subclass that is being created.
    s�
        # Adding model '%(model_name)s'
        db.create_table(%(table_name)r, (
            %(field_defs)s
        ))
        db.send_create_signal(%(app_label)r, [%(model_name)r])is
sR
        # Deleting model '%(model_name)s'
        db.delete_table(%(table_name)r)cCs||_||_dS(N(tmodelt	model_def(R
R)R*((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyt__init__Ss	cCs d|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's + Added model %s.%s(R)t_metat	app_labeltobject_name(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRWscCs�djg|j|j�j�D]\}}d||f^q�d}|ji|jjjd6|jjjd6|jjj	d6|d6S(s7Produces the code snippet that gets put into forwards()s,
            s(%r, %s)t,t
model_namet
table_nameR-t
field_defs(
R RR*RtFORWARDS_TEMPLATER)R,R.tdb_tableR-(R
tnametdefnR2((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR^s8	cCs+|ji|jjjd6|jjjd6S(s8Produces the code snippet that gets put into backwards()R0R1(tBACKWARDS_TEMPLATER)R,R.R4(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRls	(	R#R$R%R3R7R+RRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR(Cs			tDeleteModelcBs)eZdZd�Zd�Zd�ZRS(sN
    Deletion of a model. Takes the Model subclass that is being created.
    cCs d|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's - Deleted model %s.%s(R)R,R-R.(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRyscCs
tj|�S(N(R(R(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�scCs
tj|�S(N(R(R(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s(R#R$R%RRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR8ts		t_NullIssuesFieldcBs;eZdZeZeZdZd�Zd�Zd�Z	RS(sL
    A field that might need to ask a question about rogue NULL values.
    s=
        # User chose to not deal with backwards NULL issues for '%(model_name)s.%(field_name)s'
        raise RuntimeError("Cannot reverse this migration. '%(model_name)s.%(field_name)s' and its values cannot be restored.")
        
        # The following code is provided here to aid in writing a correct migrationcCsQt|ttf�r6|jr6td�|dd<dStd|jjj|j	f�td|j
�td�td|jr�dnd	�td
�|jr�td�nxetrt
d�}|d
kr�tjd�q�|dkr�Pq�|dkr|jrPq�td�q�W|dkr5|j||�n|dkrMt|_ndS(NtitdefaultsH ? The field '%s.%s' does not have a default specified, yet is NOT NULL.s/ ? Since you are %s, you MUST specify a defaults5 ? value to use for existing rows. Would you like to:s ?  1. Quit nowt.s-, and add a default to the field in models.pys> ?  2. Specify a one-off value to use for existing columns nowsj ?  3. Disable the backwards migration by raising an exception; you can edit the migration to fix it laters ? Please select a choice: t1it2t3s ! Invalid choice.(t
isinstanceRRtblanktreprtprintR)R,R.R5tnull_reasontissue_with_backward_migrationtTrueR
tsystexittadd_one_time_defaulttirreversible(R
Rt	field_deftchoice((s9/usr/lib/python2.7/site-packages/south/creator/actions.pytdeal_with_not_null_no_default�s2

	
	cCs�td�td�x�tr�td�}|s<td�q|dkrXtjd�qyt|iitd6�}Wn'ttfk
r�}td|�qXPqWt	|�|d	d
<dS(Ns; ? Please enter Python code for your one-off default value.sM ? The datetime module is available, so you can do e.g. datetime.date.today()s >>> s> ! Please enter some code, or 'exit' (with no quotes) to exit.RHitdatetimes ! Invalid input: %siR;(
RCRFR
RGRHtevalR	tSyntaxErrort	NameErrorR(R
RRKtcodetresultte((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRI�s

	
cCs?|ji|jjjd6|jjjd6|jd6|jd6S(NR0R1t
field_nametfield_column(tIRREVERSIBLE_TEMPLATER)R,R.R4R5tcolumn(R
R((s9/usr/lib/python2.7/site-packages/south/creator/actions.pytirreversable_code�s
	
(
R#R$R%R&RERJRWRMRIRY(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR9�s		tAddFieldcBsTeZdZdZdddZdddZd�Zd�Zd�Zd	�Z	RS(
sJ
    Adds a field to a model. Takes a Model class and the field name.
    sadding this fields�
        # Adding field '%(model_name)s.%(field_name)s'
        db.add_column(%(table_name)r, %(field_name)r,
                      %(field_def)s,
                      keep_default=False)is
st
        # Deleting field '%(model_name)s.%(field_name)s'
        db.delete_column(%(table_name)r, %(field_column)r)cCsv||_||_||_|jj}|jjdk	oH|jjtk	}|rr|rr|j|j|j�ndS(N(R)RRKtnullR;tNoneRRM(R
R)RRKtis_nullR;((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR+�s			$cCs)d|jj|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's + Added field %s on %s.%s(RR5R)R,R-R.(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s	cCsX|ji|jjjd6|jjjd6|jjd6|jjd6|j|j	�d6S(NR0R1RURVRK(
R3R)R,R.R4RR5RXRRK(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s	

cCsE|ji|jjjd6|jjjd6|jjd6|jjd6S(NR0R1RURV(R7R)R,R.R4RR5RX(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRs
	
(
R#R$R%RDR3R7R+RRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRZ�s			
tDeleteFieldcBs5eZdZdZeZd�Zd�Zd�ZRS(sO
    Removes a field from a model. Takes a Model class and the field name.
    sremoving this fieldcCs)d|jj|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's - Deleted field %s on %s.%s(RR5R)R,R-R.(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRs	cCs
tj|�S(N(RZR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRscCs7|jstj|�S|j|j�tj|�SdS(N(RJRZRRYR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRs	
(	R#R$R%RDRFRERRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR^	s		tChangeFieldcBsQeZdZdZdZZdZd�Zd�Zd�Z	d�Z
d�ZRS(	s4
    Changes a field's type/options on a model.
    smaking this field non-nullables�
        # Changing field '%(model_name)s.%(field_name)s'
        db.alter_column(%(table_name)r, %(field_column)r, %(field_def)s)s�
        # Renaming column for '%(model_name)s.%(field_name)s' to match new field type.
        db.rename_column(%(table_name)r, %(old_column)r, %(new_column)r)c	Cs�||_||_||_||_||_|jjdk	oN|jjtk	}|jjdk	or|jjtk	}|jjr�|jjr�|r�|j	|j|j�n|jjr�|jjr�|r�d|_
t|_|j	|j|j�ndS(Nsmaking this field nullable(
R)t	old_fieldt	new_fieldtold_deftnew_defR;R\RR[RMRDRFRE(R
R)R`RaRbRctnew_defaulttold_default((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR+2s					$$  		cCs)d|jj|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's ~ Changed field %s on %s.%s(RaR5R)R,R-R.(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRCs	cCs�d}|jj|jjkrp||ji|jjjd6|jjjd6|jd6|jd6|jd67}n||j	i|jjjd6|jjjd6|jd6|jd6|j
|�d67}|S(	NR:R0R1RUt
old_columnt
new_columnRVRK(R`RXRatRENAME_TEMPLATER)R,R.R4R5R3R(R
R`RaRctoutput((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyt_codeKs



cCs|j|j|j|j�S(N(RjR`RaRc(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRbscCsC|j|j|j|j�}|js+|S|j|j�|SdS(N(RjRaR`RbRJRY(R
tchange_code((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRes	(R#R$R%RDR3R7RhR+RRjRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR_#s
				t	AddUniquecBsTeZdZdddZdddZeZd�Zd�Zd�Z	d�Z
RS(	sW
    Adds a unique constraint to a model. Takes a Model class and the field names.
    s�
        # Adding unique constraint on '%(model_name)s', fields %(field_names)s
        db.create_unique(%(table_name)r, %(fields)r)is
s�
        # Removing unique constraint on '%(model_name)s', fields %(field_names)s
        db.delete_unique(%(table_name)r, %(fields)r)cCs||_||_dS(N(R)R(R
R)R((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR+|s	cCs<dg|jD]}|j^q
|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's* + Added unique constraint for %s on %s.%s(RR5R)R,R-R.(R
tx((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�scCsk|ji|jjjd6|jjjd6g|jD]}|j^q3d6g|jD]}|j^qSd6S(NR0R1Rtfield_names(R3R)R,R.R4RRXR5(R
R((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s
	 cCsk|ji|jjjd6|jjjd6g|jD]}|j^q3d6g|jD]}|j^qSd6S(NR0R1RRn(R7R)R,R.R4RRXR5(R
R((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s
	 (R#R$R%R3R7RFRR+RRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRlms				tDeleteUniquecBs5eZdZeZeZd�Zd�Zd�Z	RS(s\
    Removes a unique constraint from a model. Takes a Model class and the field names.
    cCs<dg|jD]}|j^q
|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's, - Deleted unique constraint for %s on %s.%s(RR5R)R,R-R.(R
Rm((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�scCs
tj|�S(N(RlR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�scCs
tj|�S(N(RlR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s(
R#R$R%RFRR&RRRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRo�s		tAddIndexcBs3eZdZdddZdddZd�ZRS(sU
    Adds an index to a model field[s]. Takes a Model class and the field names.
    sw
        # Adding index on '%(model_name)s', fields %(field_names)s
        db.create_index(%(table_name)r, %(fields)r)is
sy
        # Removing index on '%(model_name)s', fields %(field_names)s
        db.delete_index(%(table_name)r, %(fields)r)cCs<dg|jD]}|j^q
|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's + Added index for %s on %s.%s(RR5R)R,R-R.(R
Rm((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s(R#R$R%R3R7R(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRp�stDeleteIndexcBs)eZdZd�Zd�Zd�ZRS(sY
    Deletes an index off a model field[s]. Takes a Model class and the field names.
    cCs<dg|jD]}|j^q
|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's  + Deleted index for %s on %s.%s(RR5R)R,R-R.(R
Rm((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�scCs
tj|�S(N(RpR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�scCs
tj|�S(N(RpR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s(R#R$R%RRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRq�s		tAddM2McBsWeZdZdddZdddZd�Zd�Zd�Zd�Zd	�Z	RS(
sW
    Adds a unique constraint to a model. Takes a Model class and the field names.
    s�
        # Adding M2M table for field %(field_name)s on '%(model_name)s'
        m2m_table_name = %(table_name)s
        db.create_table(m2m_table_name, (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            (%(left_field)r, models.ForeignKey(orm[%(left_model_key)r], null=False)),
            (%(right_field)r, models.ForeignKey(orm[%(right_model_key)r], null=False))
        ))
        db.create_unique(m2m_table_name, [%(left_column)r, %(right_column)r])is
sr
        # Removing M2M table for field %(field_name)s on '%(model_name)s'
        db.delete_table(%(table_name)s)cCs||_||_dS(N(R)R(R
R)R((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR+�s	cCs)d|jj|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's" + Added M2M table for %s on %s.%s(RR5R)R,R-R.(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s	cCsH|j}|j}|r d|Sd|jjj|jf}d|SdS(Ns%rs%s_%ssdb.shorten_name(%r)(RR4R)R,R5(R
tftexplicittauto((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR1�s		cCs�|ji	|jjjd6|jjd6|j�d6|jj�d d6|jj�d6t|j�d6|jj	�d d6|jj	�d	6t|jj
j�d
6S(NR0RUR1i����t
left_fieldtleft_columntleft_model_keytright_fieldtright_columntright_model_key(R3R)R,R.RR5R1tm2m_column_nameRtm2m_reverse_nametreltto(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRs	

cCs5|ji|jjjd6|jjd6|j�d6S(NR0RUR1(R7R)R,R.RR5R1(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRs	
(
R#R$R%R3R7R+RR1RR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyRr�s
				t	DeleteM2McBs)eZdZd�Zd�Zd�ZRS(sW
    Adds a unique constraint to a model. Takes a Model class and the field names.
    cCs)d|jj|jjj|jjjfS(sEReturns the string to print on the console, e.g. ' + Added field foo's$ - Deleted M2M table for %s on %s.%s(RR5R)R,R-R.(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR"s	cCs
tj|�S(N(RrR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR*scCs
tj|�S(N(RrR(R
((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR-s(R#R$R%RRR(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyR�s		("R%t
__future__RRGtdjango.db.models.fields.relatedRtdjango.db.models.fieldsRRRRtsouth.modelsinspectorRtsouth.creator.freezerRRtsouth.utilsR	tsouth.utils.py3R
tobjectRR(R8R9RZR^R_RlRoRpRqRrR�(((s9/usr/lib/python2.7/site-packages/south/creator/actions.pyt<module>s*"/1J8J-B

https://t.me/AnonymousX5 - 2025