These are chat archives for django/django

18th
Apr 2016
samkurma
@samkurma
Apr 18 2016 09:42
Hi everyone, i have a requirement just to enter the multiple educational details and multiple experience details into a table from a single application, i am using inlineformset and its inserting the first record only... how can i achieve this?
samkurma
@samkurma
Apr 18 2016 11:24
I have done this one:

@login_required
def ApplicationForm(request):
StudentFormset=inlineformset_factory(User, StudentCandidateApplication,exclude=('application_status',
'bonafide_flag','parallel_studies_flag'),max_num=1, extra=1,validate_max=True)
QualificationFormset=modelformset_factory(StudentCandidateQualification,
exclude=('application',),validate_max=True,can_delete=True)
ExpFormset=modelformset_factory(StudentCandidateWorkExperience,
exclude=('application',),validate_max=True,can_delete=True)
if request.method =='POST':
studentFormset=StudentFormset(request.POST,instance=request.user,prefix='personal')
qualificationFormset=QualificationFormset(request.POST,prefix='qualification')
expFormset=ExpFormset(request.POST,prefix='experience')
if studentFormset.is_valid() and qualificationFormset.is_valid() and expFormset.is_valid():
studentFormset.save()
applicant=StudentCandidateApplication.objects.get(login_email=request.user)
qlist =[]
elist=[]

        for form in qualificationFormset:
            qForm=form.save(commit=False)
            qForm.application=applicant
            qlist.append(qForm)


        for form in expFormset:
            eForm=form.save(commit=False)
            eForm.application=applicant
            elist.append(eForm)
        print qlist,elist
        StudentCandidateQualification.objects.bulk_create(qlist)

StudentCandidateWorkExperience.objects.bulk_create(elist)

        return HttpResponseRedirect('/admin/')
else:

studentFormset=StudentFormset(instance=request.user,prefix='personal')
qualificationFormset=QualificationFormset(prefix='qualification')
expFormset=ExpFormset(prefix='experience')
return render(request,'application_form.html',{'studentFormset':studentFormset,
'qualificationFormset':qualificationFormset,
'expFormset':ExpFormset,

    })
Kiran Kumar Chaudhary
@chaudharykiran
Apr 18 2016 12:15
I am new in django. I want to build Login System for my app.For this I want to use authenticate() and login(). But I am always getting None as user return by authenticate(). It really confusing. What to do, please help
Patrick Harding
@senorpatricio
Apr 18 2016 20:46
@kiran This was a helpful tutorial, although it is with a previous version of Django
http://arunrocks.com/building-a-hacker-news-clone-in-django-part-1/
Sean Perry
@shaleh
Apr 18 2016 23:14
When I was learning Django I used the django-pdb module. It made finding places where I had passed in the wrong thing pretty easy. Is this still possible? My Django is rusty.