Example #1
0
    def done(self, form_list, **kwargs):
        msg = _('Your project has been created.')
        messages.info(self.request, msg)

        # send first order here is importnat
        # as we need to handle edit projet vs create new
        is_new = True if hasattr(self.project.data, 'profile_is_complete') is False else False
        PROJECT_CREATED.send(sender=self, instance=self.project, created=is_new)
        # this event will set the profile_is_complete setting
        PROJECT_PROFILE_IS_COMPLETE.send(sender=self, instance=self.project)

        return HttpResponseRedirect(reverse('dashboard:overview'))
Example #2
0
    def setUp(self):
        super(BaseLawyerCustomerProjectCaseMixin, self).setUp()

        self.client = DjangoTestClientWithPATCH()

        self.password = '******'
        self.customer_user = mommy.make('auth.User', username='******', first_name='Customer', last_name='A', email='*****@*****.**')
        self.customer_user.set_password(self.password)
        self.customer_user.save()

        self.company = mommy.make('company.Company', name='Test Company', customers=(self.customer_user,))

        customer_profile = self.customer_user.profile
        customer_profile.profile_data['user_class_name'] = 'customer'
        customer_profile.profile_data['is_customer'] = True
        customer_profile.save()

        self.customer = mommy.make('customer.Customer', user=self.customer_user)
        self.customer.data['company_name'] = self.company.name
        self.customer.save()

        self.lawyer_user = mommy.make('auth.User', username='******', first_name='Lawyer', last_name='A', email='*****@*****.**')
        self.lawyer_user.set_password(self.password)
        self.lawyer_user.save()

        lawyer_profile = self.lawyer_user.profile
        lawyer_profile.profile_data['user_class_name'] = 'lawyer'
        lawyer_profile.profile_data['is_lawyer'] = True
        lawyer_profile.save()

        self.lawyer = mommy.make('lawyer.Lawyer', user=self.lawyer_user)

        self.project = mommy.make('project.project', customer=self.customer, company=self.company, lawyers=(self.lawyer,), transactions=(Transaction.objects.get(slug='CS'), Transaction.objects.get(slug='SF'),))
        # send the create signals so that
        # the create todo items gets fired
        PROJECT_CREATED.send(sender=self, instance=self.project, created=True)
        PROJECT_PROFILE_IS_COMPLETE.send(sender=self, instance=self.project)

        # set the join to status engaged
        self.project_lawyer_join = self.project.projectlawyer_set.all()[0]
        self.project_lawyer_join.status = self.project_lawyer_join._LAWYER_STATUS.assigned
        self.project_lawyer_join.save(update_fields=['status'])

        self.todo = mommy.make('todo.ToDo', status=TODO_STATUS.open, project=self.project, user=self.lawyer_user, category='General', name="My Todo")

        self.attachment = mommy.make('todo.Attachment', attachment=TEST_PDF_FILE, project=self.project, todo=self.todo, uploaded_by=self.customer_user)