Ejemplo n.º 1
0
 def post(self, request, pk):
     criminal = Criminals.objects.get(id=pk)
     bound_form = CriminalManhuntAddForm(request.POST)
     context = {
         'criminal': criminal,
         'form': bound_form,
     }
     if bound_form.is_valid():
         new_manhunt = bound_form.save(commit=False)
         new_manhunt.criminal_id = criminal
         new_manhunt.save()
         action_logging_create(request, new_manhunt)
         action_logging_added(request, criminal, new_manhunt)
         return redirect(criminal)
     return render(request,
                   'reestr/criminals/add/manhunt_add.html',
                   context=context)
Ejemplo n.º 2
0
    def post(self, request, pk):
        bound_form = CriminalAddAddressForm(request.POST)
        criminal = Criminals.objects.get(id=pk)

        if bound_form.is_valid():
            new_address = bound_form.save(commit=False)
            new_address.criminal_id = criminal
            new_address.save()
            action_logging_create(request, new_address)
            action_logging_added(request, criminal, new_address)
            return redirect(criminal)
        return render(request,
                      'reestr/criminals/add/criminal_add_address.html',
                      context={
                          'form': bound_form,
                          'criminal': criminal
                      })
Ejemplo n.º 3
0
def add_existing_criminal_to_cc(request, pk):
    cc = CriminalCase.objects.get(id=pk)
    if request.POST:
        bound_form = AddExistingCriminalForm(request.POST)
        if bound_form.is_valid():
            new_case = bound_form.save(commit=False)
            new_case.criminal_case = cc
            if CriminalCaseCriminals.objects.filter(
                    criminal_case=new_case.criminal_case).filter(
                        criminal_id=new_case.criminal_id):
                return redirect(cc)
            else:
                action_logging_added(request, cc, new_case.criminal_id)
                new_case.save()
            return redirect(cc)
        return redirect(cc)
    return redirect(cc)
Ejemplo n.º 4
0
    def post(self, request, pk):
        criminal = Criminals.objects.get(id=pk)
        bound_case_form = CriminalCaseCreateForm(request.POST)
        bound_case_add_form = CriminalsCriminalCaseAddForm(request.POST)
        context = {
            'criminal': criminal,
            'case_form': bound_case_form,
            'case_add_form': bound_case_add_form
        }

        if bound_case_form.is_valid() and bound_case_add_form.is_valid():
            new_case = bound_case_form.save()
            new_add_case = bound_case_add_form.save(commit=False)
            new_add_case.criminal_id = criminal
            new_add_case.criminal_case = new_case
            new_add_case.save()
            action_logging_create(request, new_case)
            action_logging_added(request, criminal, new_case)
            return redirect(criminal)
        return render(request,
                      'reestr/criminals/add/criminal_case_add.html',
                      context=context)
Ejemplo n.º 5
0
    def post(self, request, pk):
        bound_add_form = CriminalAddContactPersonForm(request.POST)
        bound_person_form = PersonsCreateForm(request.POST)
        criminal = Criminals.objects.get(id=pk)

        if bound_add_form.is_valid() and bound_person_form.is_valid():
            new_person = bound_person_form.save(commit=False)
            new_person.user = request.user.profile
            new_person.save()
            new_add = bound_add_form.save(commit=False)
            new_add.criminal_id = criminal
            new_add.person_id = new_person
            new_add.save()
            action_logging_create(request, new_person)
            action_logging_added(request, criminal, new_person)
            return redirect(criminal)
        return render(request,
                      'reestr/criminals/add/criminal_add_contact-person.html',
                      context={
                          'person_form': bound_person_form,
                          'add_form': bound_add_form,
                          'criminal': criminal
                      })