示例#1
0
def create_planning(request):
    """
    View for dynamic creation of a planning
    """
    planning_data = json.loads(request.POST['planning_data'])
    planning = Planning(name=planning_data['title'])
    planning.save()
    planning.add_elements(planning_data['planning_elements'])
    add_tags_to_model(planning_data['tags'], planning)

    return HttpResponse()
示例#2
0
def create_planning(request):
    """
    View for dynamic creation of a planning
    """
    planning_data = json.loads(request.POST['planning_data'])
    planning = Planning(name=planning_data['title'])
    planning.save()
    planning.add_elements(planning_data['planning_elements'])
    add_tags_to_model(planning_data['tags'], planning)

    return HttpResponse()
示例#3
0
def duplicate_planning(request):
    planning = Planning.objects.get(id=request.GET["planning_id"])
    new_planning = Planning(name=request.GET["name"], active = False)
    new_planning.save()
    for planning_element in planning.planningelement_set.all():
        # Set id to none to create a new element
        planning_element.id = None
        planning_element.planning = new_planning
        planning_element.save()

    return HttpResponse()
示例#4
0
def duplicate_planning(request):
    planning = Planning.objects.get(id=request.GET["planning_id"])
    new_planning = Planning(name=request.GET["name"], active=False)
    new_planning.save()
    for planning_element in planning.planningelement_set.all():
        # Set id to none to create a new element
        planning_element.id = None
        planning_element.planning = new_planning
        planning_element.save()

    return HttpResponse()