Beispiel #1
0
def setup_required_service():
    service_type = ServiceType()
    service_type.name = "Tipo de Servico"
    service_type.save()

    area1 = Area()
    area1.area_name = "area 1"
    area1.save()

    organization1 = Organization.objects.get(name=user_stub()["organization"])

    service1 = Service()
    service1.area = area1
    service1.name = "Servico 1"
    service1.organization = organization1
    service1.service_type = service_type
    service1.save()

    a = AdmissionChoice()
    a.weight = 1
    a.save()

    u = User()
    u.username = "******"
    u.password = "******"
    u.is_superuser = True
    u.save()

    person = Person()
    person.name = "nome12"
    person.user = u
    person.nickname = "apelido12"
    person.save()
    person.organization.add(organization1)
    person.save()
Beispiel #2
0
def setup_required_service():
    service_type = ServiceType()
    service_type.name="Tipo de Servico"
    service_type.save()

    area1 = Area()
    area1.area_name = "area 1"
    area1.save()

    organization1 = Organization.objects.get(name=user_stub()["organization"])

    service1 = Service()
    service1.area = area1;
    service1.name = "Servico 1"
    service1.organization = organization1
    service1.service_type = service_type
    service1.save()

    a = AdmissionChoice()
    a.weight = 1
    a.save()

    u = User()
    u.username = "******"
    u.password = "******"
    u.is_superuser = True
    u.save()

    person = Person()
    person.name = "nome12"
    person.user = u
    person.nickname = "apelido12"
    person.save()
    person.organization.add(organization1)
    person.save()
Beispiel #3
0
def save_mini_professional(request):
    object = CareProfessional()
    person = Person()
    person.name = request.POST.get('label')
    person.save()
    person.organization.add(Organization.objects.get(pk=request.POST.get('organization')))
    object.person = person
    object.save()

    return HttpResponse("%s" % (object.id))
Beispiel #4
0
def save_mini_professional(request):
    object = CareProfessional()
    person = Person()
    person.name = request.POST.get('label')
    person.save()
    person.organization.add(
        Organization.objects.get(pk=request.POST.get('organization')))
    object.person = person
    object.save()

    return HttpResponse("%s" % (object.id))
Beispiel #5
0
def contact_professional_save(request, object_id=None):

    try:
        object = get_object_or_404(CareProfessional, pk=object_id)
        identification = object.professionalIdentification
        person = object.person
    except:
        object = CareProfessional()
        person = Person()

    if object.id and not have_careprofessional_perms_save(request, object):
        return render_to_response('403.html', {
            'object': _("Access Denied"),
        },
                                  context_instance=RequestContext(request))

    if not request.POST.get('name'):
        return HttpResponseRedirect(
            ('/contact/form/professional/' if not object.id else
             ('/contact/form/professional/%s/') % object.id))

    if not object.professionalIdentification:
        if request.POST.get('symbol'):
            identification = ProfessionalIdentification()
            identification.profession = Profession.objects.get(
                id=request.POST.get('service_profession'))
            identification.registerNumber = request.POST.get(
                'professional_subscription')
            identification.save()
            object.professionalIdentification = identification
        else:
            object.professionalIdentification = None

    person.name = request.POST.get('name')
    person.save()

    person.organization.remove()
    person.organization.add(
        Organization.objects.get(pk=request.POST.get('organization')))

    person = extra_data_save(request, person)

    object.comments = request.POST.get('comments')
    object.person = person
    object.save()

    messages.success(request, _('Professional contact saved successfully'))
    return HttpResponseRedirect('/contact/form/professional/%s/' % (object.id))
def contact_professional_save(request, object_id=None):

    try:
        object = get_object_or_404(CareProfessional, pk=object_id)
        identification = object.professionalIdentification
        person = object.person
    except:
        object = CareProfessional()
        person = Person()

    if object.id and not have_careprofessional_perms_save(request, object):
        return render_to_response('403.html', {'object': _("Access Denied"), }, context_instance=RequestContext(request))

    if not request.POST.get('name'):
        return HttpResponseRedirect(('/contact/form/professional/' if not object.id else ('/contact/form/professional/%s/') % object.id))

    if not object.professionalIdentification:
        if request.POST.get('symbol'):
            identification = ProfessionalIdentification()
            identification.profession = Profession.objects.get(
                id=request.POST.get('service_profession'))
            identification.registerNumber = request.POST.get(
                'professional_subscription')
            identification.save()
            object.professionalIdentification = identification
        else:
            object.professionalIdentification = None

    person.name = request.POST.get('name')
    person.save()

    person.organization.remove()
    person.organization.add(Organization.objects.get(
        pk=request.POST.get('organization')))

    person = extra_data_save(request, person)

    object.comments = request.POST.get('comments')
    object.person = person
    object.save()

    messages.success(request, _('Professional contact saved successfully'))
    return HttpResponseRedirect('/contact/form/professional/%s/' % (object.id))