Create new record in Django

Posted under » Django on 4 December 2025

We have done creating and updating a record using Django API. We have created a new user before. For this to happen, you have to import the app model.

from shitapp.models import Candidate

def addcand(request):
    testid = 8
    vuser = 20
    d = '2025-12-01 15:25:00+01'
    cad = Candidate(user_id=vuser, test_id=testid, enrolled_date=d)
    cad.save()
    return HttpResponse('added candidate info')

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data