Example #1
0
def create_new_group(user_name, group_name):
    group_name = replace_letters(group_name)
    count = Group.objects.filter(group_name=group_name).count()
    message = None
    if count > 0:
        message = "the name " + group_name +  \
            " is taken, please select differnt name"
    else:
        new_group = Group(group_name=group_name,
                          user_name=user_name,
                          shared=True)
        new_group.save()
    return message
Example #2
0
def create_new_group(user_name, group_name):
    group_name = replace_letters(group_name)
    count = Group.objects.filter(group_name=group_name).count()
    message = None
    if count > 0:
        message = "the name " + group_name +  \
            " is taken, please select differnt name"
    else:
        new_group = Group(
            group_name=group_name,
            user_name=user_name,
            shared=True
        )
        new_group.save()
    return message
Example #3
0
def rename_group(request):
    if request.method == 'POST':
        old_name = request.POST['old_name']
        new_name = request.POST['new_name']
        new_name = replace_letters(new_name)
        groups = Group.objects.filter(group_name=old_name)
        results = Result.objects.filter(group_name=old_name)
        for result in results:
            result.group_name = new_name
            result.save()
        for group in groups:
            group.group_name = new_name
            group.save()

    return HttpResponseRedirect(reverse('groups:save_group'))
Example #4
0
def rename_group(request):
    if request.method == 'POST':
        old_name = request.POST['old_name']
        new_name = request.POST['new_name']
        new_name = replace_letters(new_name)
        groups = Group.objects.filter(group_name=old_name)
        processes = Process.objects.filter(group_name=old_name)
        summaries = Summary.objects.filter(group_name=old_name)
        for process in processes:
            process.group_name = new_name
            process.save()
        for summary in summaries:
            summary.group_name = new_name
            summary.save()
        for group in groups:
            group.group_name = new_name
            group.save()
    return HttpResponseRedirect(reverse('groups:save_group'))
Example #5
0
def rename_group(request):
    if request.method == 'POST':
        old_name = request.POST['old_name']
        new_name = request.POST['new_name']
        new_name = replace_letters(new_name)
        groups = Group.objects.filter(
            group_name=old_name)
        processes = Process.objects.filter(group_name=old_name)
        summaries = Summary.objects.filter(group_name=old_name)
        for process in processes:
            process.group_name = new_name
            process.save()
        for summary in summaries:
            summary.group_name = new_name
            summary.save()
        for group in groups:
            group.group_name = new_name
            group.save()
    return HttpResponseRedirect(reverse('groups:save_group'))