예제 #1
0
def office_new(request, company_id):
    company = get_object_or_404(Company, pk=company_id)

    if request.method == 'POST':
        form = OfficeForm(request.POST)

        if form.is_valid():
            office = form.save(commit=False)
            office.save()
            form.save_m2m()

            context = {
                'company': company,
                'company_logo': Logo.latest(company_id),
                'office': office
            }

            return render(request, 'offices/office_view.html', context)
    else:
        form = OfficeForm()

    context = {
        'company': company,
        'company_logo': Logo.latest(company_id),
        'form': form
    }

    return render(request, 'offices/office_edit.html', context)
예제 #2
0
def office_new(request, company_id):
    company = get_object_or_404(Company, pk=company_id)

    if request.method == 'POST':
        form = OfficeForm(request.POST)

        if form.is_valid():
            office = form.save(commit=False)
            office.save()
            form.save_m2m()

            context = {
                'company': company,
                'company_logo': Logo.latest(company_id),
                'office': office
            }

            return render(request, 'offices/office_view.html', context)
    else:
        form = OfficeForm()

    context = {
        'company': company,
        'company_logo': Logo.latest(company_id),
        'form': form
    }

    return render(request, 'offices/office_edit.html', context)
예제 #3
0
def office_list(request, company_id):
    context = {
        'company': get_object_or_404(Company, pk=company_id),
        'company_logo': Logo.latest(company_id),
        'office_list': Office.list(company_id)
    }

    return render(request, 'offices/office_list.html', context)
예제 #4
0
def office_view(request, company_id, office_id):
    context = {
        'company': get_object_or_404(Company, pk=company_id),
        'company_logo': Logo.latest(company_id),
        'office': get_object_or_404(Office, pk=office_id)
    }

    return render(request, 'offices/office_view.html', context)
예제 #5
0
def office_list(request, company_id):
    context = {
        'company': get_object_or_404(Company, pk=company_id),
        'company_logo': Logo.latest(company_id),
        'office_list': Office.list(company_id)
    }

    return render(request, 'offices/office_list.html', context)
예제 #6
0
def office_view(request, company_id, office_id):
    context = {
        'company': get_object_or_404(Company, pk=company_id),
        'company_logo': Logo.latest(company_id),
        'office': get_object_or_404(Office, pk=office_id)
    }

    return render(request, 'offices/office_view.html', context)