title: django AttributeError, type object 'object' has no attribute python 3
body: <p>got an error when post the data</p>
  
  <pre><code>AttributeError at /system/create/
  type object 'object' has no attribute 'EmpInstallment'
  Request Method: POST
  Request URL:    http://127.0.0.1:8000/system/create/
  Django Version: 1.11.2
  Exception Type: AttributeError
  Exception Value:    
  type object 'object' has no attribute 'EmpInstallment'
  Exception Location: /Users/wakanda/pyproject/payroll/system/views.py in form_valid, line 117
  Python Executable:  /Users/wakanda/py-virtualenv/payroll3/bin/python
  Python Version: 3.6.5
  Python Path:    
  ['/Users/wakanda/pyproject/payroll',
   '/Users/wakanda/py-virtualenv/payroll3/lib/python36.zip',
   '/Users/wakanda/py-virtualenv/payroll3/lib/python3.6',
   '/Users/wakanda/py-virtualenv/payroll3/lib/python3.6/lib-dynload',
   '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6',
   '/Users/wakanda/py-virtualenv/payroll3/lib/python3.6/site-packages',
   '/Users/wakanda/py-virtualenv/payroll3/lib/python3.6/site-packages/setuptools-39.0.1-py3.6.egg',
   '/Users/wakanda/py-virtualenv/payroll3/lib/python3.6/site-packages/configparser-3.5.0-py3.6.egg']
  </code></pre>
  
  <p><strong>model.py</strong></p>
  
  <pre><code>class Employee(models.Model):
      nik = models.CharField(max_length=100)
      name = models.CharField(max_length=100)
  
      def __str__(self):
          return self.name
  
      def get_absolute_url(self):
          return reverse("system:detail",kwargs={'pk':self.pk})
  
  class EmpLoan(models.Model):
      status = models.BooleanField()
      nominal = models.DecimalField(max_digits=10, decimal_places=0)
      emp = models.ForeignKey(Employee, related_name='emploan')
      created_at = models.DateTimeField(auto_now=True)
      updated_at = models.DateTimeField(auto_now_add=True, null=True)
  
      def __str__(self):
          return self.emp.name
  
  class EmpInstallment(models.Model):
      nominal = models.DecimalField(max_digits=10, decimal_places=0)
      loan = models.ForeignKey(EmpLoan, related_name='empinstallment')
      created_at = models.DateTimeField(auto_now=True)
  
      def __str__(self):
          return self.loan.emp.name
  </code></pre>
  
  <p><strong>view.py</strong></p>
  
  <pre><code>class EmployeeCreateView(CreateView):
      fields = ('spl', 'status')
      model = models.Employee
  
      def form_valid(self, form):
          self.object = form.save(commit=False)
  
          try:
              pinjaman = models.EmpLoan.objects.get(emp_id=1, status=0)
              cicilans = models.EmpInstallment.objects.filter(loan_id=pinjaman.id).values_list('id', flat=True)
              totalcicilan = 0
              for i in cicilans:
                  cicilan = models.EmpInstallment.objects.get(id=i).nominal
                  totalcicilan = totalcicilan + cicilan
  
              sisapinjaman = pinjaman.nominal - totalcicilan
  
              if ( 12 - cicilans.count()) != 0:
                  cicilansekarang = sisapinjaman / ( 12 - cicilans.count())
              else:
                  cicilansekarang = 0
  
              #potongan cicilan
              hasil = round(cicilansekarang)
  
              if hasil != 0:
                  joe = models.EmpInstallment.objects.create(loan=pinjaman, nominal=hasil)
                  object.EmpInstallment.add(joe)
              else:
                  statatus_pinjaman = models.EmpLoan.objects.get(emp_id=1, status=0)
                  statatus_pinjaman.status = 1
                  statatus_pinjaman.save()
  
          except models.EmpLoan.DoesNotExist:
              hasil = 0
  
          return super(ModelFormMixin, self).form_valid(form)
  </code></pre>
  
  <p>when I click submit on my form, its showing error but checked on my database it's submitted.</p>
  
  <p>what wrong with my code?...</p>
  
  <p>especially on</p>
  
  <pre><code>joe = models.EmpInstallment.objects.create(loan=pinjaman, nominal=hasil)
  object.EmpInstallment.add(joe)
  </code></pre>
  
  <p>please explain because I am a slow learner and super noob on Django &amp; OOP.</p>