Created
December 3, 2013 02:43
-
-
Save ma1onso/7763074 to your computer and use it in GitHub Desktop.
Aprendizaje bueno para ManyToMany Form Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @login_required | |
# def optimize_campaigns(request): | |
# """ | |
# """ | |
# command_object = CommandMainRoutine() | |
# # TODO: Aqui es donde hay que implementar la tarea Celery, para cuando termine esto, mande un mensaje avisando que termino | |
# # command_object.handle(**{'campaign_id': campaign_id}) | |
# | |
# # optimize_campaign_task.delay(campaign_id) | |
# # lol = optimize_campaign_task.apply_async((campaign_id, ), link=finish_task.subtask()) | |
# | |
# campaigns = Campaign.objects.filter( | |
# adword_user=AdwordUser.objects.get(user=request.user) | |
# ) | |
# | |
# adword_user = AdwordUser.objects.get(user=request.user) | |
# | |
# campaign_to_optimize_user = adword_user.campaigns_to_optimize.all( | |
# ).values_list('id', flat=True) | |
# | |
# if request.method == 'POST': | |
# campaign_to_optimize_form = CampaignToOptimizeForm( | |
# request.POST, instance=adword_user | |
# ) | |
# | |
# if campaign_to_optimize_form.is_valid(): | |
# campaign_to_optimize_form.save() | |
# | |
# return redirect('/') | |
# else: | |
# print campaign_to_optimize_form.errors | |
# else: | |
# campaign_to_optimize_form = CampaignToOptimizeForm(instance=adword_user) | |
# # limit queryset campaign in ManyToManyField | |
# campaign_to_optimize_form.fields[ | |
# 'campaigns_to_optimize' | |
# ].queryset = campaigns | |
# | |
# return render(request, 'optimize_campaigns.html', { | |
# 'campaigns': campaigns, | |
# 'campaign_to_optimize_form': campaign_to_optimize_form, | |
# 'campaign_to_optimize_user': campaign_to_optimize_user, | |
# }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment