Example #1
0
def delete(request, gid):
    group = Group.objects.get(pk=gid)
    if request.POST:
        if 'delete' in request.POST:
            _delete(group)
            return redirect(request, '/group')
        return redirect(request, '/group/show/%d' % group.id)
    return direct_to_template(request, 'group/delete.html', {
        'instance': group,
    })
Example #2
0
def delete(request, gid):
    group = Group.objects.get(pk=gid)
    if request.POST:
        if 'delete' in request.POST:
            _delete(group)
            return redirect(request, '/group')
        return redirect(request, '/group/show/%d' % group.id)
    return direct_to_template(request, 'group/delete.html', {
        'instance': group,
        })
Example #3
0
def show_edit(request, mf):
    form = FinanceForm(instance=mf)
    if request.POST:
        if 'delete' in request.POST:
            mf.delete()
            return redirect(request, '/microfinance')
        if form.is_valid():
            form.save()
            return redirect(request, '/microfinance/show/%d' % mf.id)
    return direct_to_template(request, 'microfinance/edit.html',
                              {'form': form})
Example #4
0
def delete(request, pid):
    person = People.objects.get(pk=pid)
    if request.POST:
        if 'delete' in request.POST:
            _delete(person)
            return redirect(request, '/people')
        return redirect(request, '/people/show/%d' % person.id)
    return direct_to_template(request, 'people/delete.html', {
        'instance': person,
        'product_count': len(Product.objects.filter(person=person).all()),
        })
Example #5
0
def delete(request, pid):
    person = People.objects.get(pk=pid)
    if request.POST:
        if 'delete' in request.POST:
            _delete(person)
            return redirect(request, '/people')
        return redirect(request, '/people/show/%d' % person.id)
    return direct_to_template(
        request, 'people/delete.html', {
            'instance': person,
            'product_count': len(Product.objects.filter(person=person).all()),
        })
Example #6
0
def show_edit(request, product):
    form = ProductForm(instance=product)
    if request.POST:
        if 'delete' in request.POST:
            product.delete()
            return redirect(request, '/product')
        if form.is_valid():
            form.save()
            return redirect(request, '/product/show/%d' % product.id)
    return direct_to_template(request, 'product/edit.html', {
        'form': form,
    })
Example #7
0
def show(request, trx):
    form = TransactionForm(instance=trx)
    if request.POST:
        person_id = trx.person.id
        if 'delete' in request.POST:
            trx.delete()
            return redirect(request,
                            '/people/show/%d?tab=transaction' % person_id)
        if form.is_valid():
            form.save()
            return redirect(request,
                            '/people/show/%d?tab=transaction' % person_id)
    return direct_to_template(request, 'transaction/edit.html', {
        'form': form,
    })
Example #8
0
def show(request, cl):
    form = ClusterForm(instance=cl)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request)
    return direct_to_template(request, "cluster/edit.html", {"form": form})
Example #9
0
def type_show_edit(request, type_):
    form = TypeForm(instance=type_)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, '/product/type/%d' % type_.id)
    return direct_to_template(request, 'product/type/edit.html', {
        'form': form,
    })
Example #10
0
def show_edit(request, person):
    form = PeopleForm(instance=person)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, '/people/show/%d' % person.id)
    return direct_to_template(request, 'people/edit.html', {
        'form': form,
    })
Example #11
0
def report_show(request, report):
    form = ReportForm(instance=report)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, destination(report.group.id, 'laporan'))
    return direct_to_template(request, 'group/report/edit.html', {
        'form': form,
    })
Example #12
0
def training_show_edit(request, training):
    form = TrainingForm(instance=training)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, destination(training.group.id, 'pelatihan'))
    return direct_to_template(request, 'group/training/edit.html', {
        'form': form,
        })
Example #13
0
def training_delete(request, tid):
    training = Training.objects.get(pk=tid)
    if request.POST:
        if 'delete' in request.POST:
            training.delete()
        return redirect(request, destination(training.group.id, 'pelatihan'))
    return direct_to_template(request, 'group/training/delete.html', {
        'instance': training,
    })
Example #14
0
def training_delete(request, tid):
    training = Training.objects.get(pk=tid)
    if request.POST:
        if 'delete' in request.POST:
            training.delete()
        return redirect(request, destination(training.group.id, 'pelatihan'))
    return direct_to_template(request, 'group/training/delete.html', {
        'instance': training,
        })
Example #15
0
def report_show(request, report):
    form = ReportForm(instance=report)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, destination(report.group.id, 'laporan'))
    return direct_to_template(request, 'group/report/edit.html', {
        'form': form,
        })
Example #16
0
def report_delete(request, rid):
    report = Report.objects.get(pk=rid)
    if request.POST:
        if 'delete' in request.POST:
            report.delete()
        return redirect(request, destination(report.group.id, 'laporan'))
    return direct_to_template(request, 'group/report/delete.html', {
        'instance': report,
        })
Example #17
0
def training_show(request, training):
    form = TrainingForm(instance=training)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, '/people/show/%d?tab=pelatihan' % training.person.id)
    return direct_to_template(request, 'people/training/edit.html', {
        'form': form, 
        })
Example #18
0
def show_edit(request, person):
    form = PeopleForm(instance=person)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, '/people/show/%d' % person.id)
    return direct_to_template(request, 'people/edit.html', {
        'form': form, 
        })
Example #19
0
def delete(request, cid):
    cluster = Cluster.objects.get(pk=cid)
    if request.POST:
        if "delete" in request.POST:
            _delete(cluster)
        return redirect(request, "/livecenter/show/%d?tab=cluster" % cluster.livecenter.id)
    return direct_to_template(
        request, "cluster/delete.html", {"instance": cluster, "groups": Group.objects.filter(cluster=cluster)}
    )
Example #20
0
def report_delete(request, rid):
    report = Report.objects.get(pk=rid)
    if request.POST:
        if 'delete' in request.POST:
            report.delete()
        return redirect(request, destination(report.group.id, 'laporan'))
    return direct_to_template(request, 'group/report/delete.html', {
        'instance': report,
    })
Example #21
0
def training_show_edit(request, training):
    form = TrainingForm(instance=training)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, destination(training.group.id,
                                                 'pelatihan'))
    return direct_to_template(request, 'group/training/edit.html', {
        'form': form,
    })
Example #22
0
def training_show(request, training):
    form = TrainingForm(instance=training)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(
                request, '/people/show/%d?tab=pelatihan' % training.person.id)
    return direct_to_template(request, 'people/training/edit.html', {
        'form': form,
    })
Example #23
0
def show_edit(request, group):
    form = GroupForm(instance=group)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, '/group/show/%d' % group.id)
    return direct_to_template(request, 'group/edit.html', {
        'form': form,
        'customfields': Metaform.objects.filter(meta_type='group').\
                filter(category__in=group.livecenter.category),
        })
Example #24
0
def show_edit(request, group):
    form = GroupForm(instance=group)
    if request.POST:
        if form.is_valid():
            form.save()
            return redirect(request, '/group/show/%d' % group.id)
    return direct_to_template(request, 'group/edit.html', {
        'form': form,
        'customfields': Metaform.objects.filter(meta_type='group').\
                filter(category__in=group.livecenter.category),
        })