bulk copy data from 1 model to another in django

2016-01-12 Thread Rahul Jha
I am having 2 model of similar schema and I want to bulk copy from model1 to model2 but model2 is having 3 more fields but I want to store null in these fields. class SubscriberBalanceProcess(models.Model): VOICE_SOC = models.CharField(max_length=50, null=True) SMS_SOC = mod

Re: Copy data from 1 model to another

2008-11-26 Thread issya
Thank you for the nifty code. I changed it just a little so it would iterate through model A's queryset and get_or_create model B. It works great, thanks again. obja = Mls.objects.filter(mls_agent_id='261505106') fieldnames = FeaturedProperties._meta.get_all_field_names() for obj in obja:

Re: Copy data from 1 model to another

2008-11-26 Thread bruno desthuilliers
On 26 nov, 06:24, issya <[EMAIL PROTECTED]> wrote: > It looks like I partly answered my own question. I just do something > like the below to get the field names of the empty model B and I will > iterate through the fields until 1 matches and then assign the > information. > > This only prints out

Re: Copy data from 1 model to another

2008-11-25 Thread issya
It looks like I partly answered my own question. I just do something like the below to get the field names of the empty model B and I will iterate through the fields until 1 matches and then assign the information. This only prints out the field names. property_field = FeaturedProperties()._meta

Copy data from 1 model to another

2008-11-25 Thread issya
Model A has 50 fields. Model B has 20 of model A's 50 fields. I am trying to make a nightly cron job that will make a queryset of model A based on a filter and copy that information into model B. I also don't want it to copy the information if it already exists in model B. Does anyone know a good