示例#1
0
def update_view(request, object_id=None):
    patient = get_object_or_404(Patient, id=object_id)
    form = PatientsModelForm(request.POST or None, instance=patient)
    if form.is_valid():
        instance = form.save(commit=False)
        instance.save()
    template = "account_home.html"
    context = {
        "object": patient,
        "form": form,
    }
    return render(request, template, context)
示例#2
0
def update_view(request, object_id=None):
    patient = get_object_or_404(Patient, id=object_id)
    form = PatientsModelForm(request.POST or None, instance=patient)
    if form.is_valid():
        instance = form.save(commit=False)
        instance.save()
    template = "account_home.html"
    context = {
        "object": patient,
        "form": form,
    }
    return render(request, template, context)
示例#3
0
def create_view(request):
    form = PatientsModelForm(request.POST or None)
    user_on = request.user
    user_name = user_on.get_username()
    id =user_on.id
    if form.is_valid():
        patient = form.save(commit=False)
        patient.created_by = user_name
        patient.user_id = id
        patient.save()
    template = "create_view.html"
    context = {
        "form": form,
        "user_name": user_name,
    }
    return render(request, template, context)
示例#4
0
def create_view(request):
    form = PatientsModelForm(request.POST or None)
    user_on = request.user
    user_name = user_on.get_username()
    id = user_on.id
    if form.is_valid():
        patient = form.save(commit=False)
        patient.created_by = user_name
        patient.user_id = id
        patient.save()
    template = "create_view.html"
    context = {
        "form": form,
        "user_name": user_name,
    }
    return render(request, template, context)