1616
1717from django .db .models import TextField , CharField
1818
19+ from django .contrib .sites .models import Site
1920from ietf .redirects .models import Redirect , Suffix , Command
2021from ietf .iesg .models import TelechatAgendaItem , WGAction
2122from ietf .ipr .models import IprSelecttype , IprLicensing , IprDetail , IprContact , IprNotification , IprUpdate
2425
2526known_models = {
2627 'base' : [User ],
27- 'others' : [Redirect , Suffix , Command ,
28+ 'others' : [Site ,
29+ Redirect , Suffix , Command ,
2830 TelechatAgendaItem , WGAction ,
2931 IprSelecttype , IprLicensing , IprDetail , IprContact , IprNotification , IprUpdate ,
30- IdSubmissionStatus , IdSubmissionDetail , IdApprovedDetail , TempIdAuthors ]
32+ IdSubmissionStatus , IdSubmissionDetail , IdApprovedDetail ,
33+ TempIdAuthors ]
3134 }
3235
3336models_to_copy = known_models [sys .argv [1 ]]
@@ -53,7 +56,6 @@ def insert_many_including_pk(objects, using="default", table=None):
5356 for o in objects :
5457 pars = []
5558 for f in fields :
56- #print f.name, f.pre_save(o, True)
5759 pars .append (f .get_db_prep_save (f .pre_save (o , True ), connection = con ))
5860 parameters .append (pars )
5961
@@ -79,7 +81,12 @@ def clean_chunk(model, chunk):
7981for model in models_to_copy :
8082 sys .stdout .write ("copying %s " % model ._meta .object_name )
8183 sys .stdout .flush ()
82- table_name = "%s_%s" % (model ._meta .app_label , model ._meta .object_name .lower ())
84+
85+ irregular_models = [Site ]
86+ if model in irregular_models :
87+ table_name = Site ._meta .db_table
88+ else :
89+ table_name = "%s_%s" % (model ._meta .app_label , model ._meta .object_name .lower ())
8390
8491 for chunk in queryset_chunks (model .objects .using ("legacy" ).all (), 1000 ):
8592 clean_chunk (model , chunk )
0 commit comments