Пример #1
0
def create_follows():

	Follow.objects.all().delete()

	for pk, fields in follows.iteritems():

		try:
			f = Follow(pk=pk)
			f.user_id = get_user(fields['user'])
			if fields['object_type'] == 'dateaaction':
				campaign = Campaign.objects.get(pk=fields['object_id'])
				f.content_object = campaign.main_tag
				f.follow_key = 'tag.'+str(campaign.main_tag.pk)
				f.object_id = campaign.main_tag.pk
				f.client_domain = datea
				f.save()
			elif fields['object_type'] == 'dateamapitem':
				dateo = Dateo.object.get(pk=fields['object_id'])
				f.content_object = dateo
				f.object_id = dateo.pk
				f.follow_key = 'dateo.'+str(dateo.pk)
				f.client_domain = datea
				f.save()
		except:
			pass