Beispiel #1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="State",
            fields=[
                (
                    "abbreviation",
                    localflavor.us.models.USStateField(max_length=2,
                                                       primary_key=True,
                                                       serialize=False),
                ),
                ("collects_saas_tax", models.BooleanField(default=False)),
                (
                    "tax_base",
                    models.CharField(
                        choices=[
                            ("ORIGIN", "Origin-based"),
                            ("DESTINATION", "Destination-based"),
                        ],
                        default="DESTINATION",
                        max_length=30,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="ZipCode",
            fields=[
                (
                    "code",
                    models.CharField(max_length=9,
                                     primary_key=True,
                                     serialize=False),
                ),
                (
                    "tax_rate",
                    models.DecimalField(blank=True,
                                        decimal_places=4,
                                        max_digits=5,
                                        null=True),
                ),
                ("last_checked", models.DateTimeField(blank=True, null=True)),
                (
                    "state",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="zipcodes",
                        to="taxtea.State",
                    ),
                ),
            ],
        ),
    ]
Beispiel #2
0
class ApplicantStandardCategoryGrade(models.Model):
    """ Grade for a category and result """
    category = models.ForeignKey('standard_test.StandardCategory')
    result = models.ForeignKey(ApplicantStandardTestResult)
    grade = models.DecimalField(max_digits=6, decimal_places=2)
Beispiel #3
0
class Applicant(models.Model, CustomFieldModel):
    fname = models.CharField(max_length=255, verbose_name="First Name")
    mname = models.CharField(max_length=255,
                             verbose_name="Middle Name",
                             blank=True)
    lname = models.CharField(max_length=255, verbose_name="Last Name")
    pic = models.ImageField(upload_to="applicant_pics", blank=True, null=True)
    sex = models.CharField(max_length=1,
                           choices=(('M', 'Male'), ('F', 'Female')),
                           blank=True)
    bday = models.DateField(blank=True,
                            null=True,
                            verbose_name="Birth Date",
                            validators=settings.DATE_VALIDATORS)
    unique_id = models.IntegerField(blank=True, null=True, unique=True)
    street = models.CharField(max_length=150, blank=True)
    city = models.CharField(max_length=360, blank=True)
    state = USStateField(blank=True)
    zip = models.CharField(max_length=10, blank=True)
    ssn = models.CharField(max_length=11, blank=True, verbose_name="SSN")
    parent_email = models.EmailField(blank=True, null=True)
    email = models.EmailField(blank=True, null=True)
    notes = models.TextField(blank=True)
    family_preferred_language = models.ForeignKey('sis.LanguageChoice',
                                                  blank=True,
                                                  null=True,
                                                  on_delete=models.SET_NULL,
                                                  default=get_default_language)
    siblings = models.ManyToManyField('sis.Student',
                                      blank=True,
                                      related_name="+")
    year = models.ForeignKey('sis.GradeLevel',
                             blank=True,
                             null=True,
                             on_delete=models.SET_NULL,
                             help_text="Applying for this grade level",
                             default=get_year)
    school_year = models.ForeignKey('sis.SchoolYear',
                                    blank=True,
                                    null=True,
                                    on_delete=models.SET_NULL,
                                    default=get_school_year)
    parent_guardians = models.ManyToManyField('sis.EmergencyContact',
                                              verbose_name="Student contact",
                                              blank=True,
                                              null=True)
    ethnicity = models.ForeignKey(
        EthnicityChoice,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    hs_grad_yr = models.IntegerField(blank=True, null=True, max_length=4)
    elem_grad_yr = models.IntegerField(blank=True, null=True, max_length=4)
    present_school = models.ForeignKey(
        FeederSchool,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    present_school_typed = models.CharField(
        max_length=255,
        blank=True,
        help_text=
        "This is intended for applicants to apply for the school. Administrators should use the above."
    )
    present_school_type_typed = models.CharField(max_length=255, blank=True)
    religion = models.ForeignKey(
        ReligionChoice,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    place_of_worship = models.ForeignKey(
        PlaceOfWorship,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    follow_up_date = models.DateField(blank=True,
                                      null=True,
                                      validators=settings.DATE_VALIDATORS)
    open_house_attended = models.ManyToManyField(OpenHouse,
                                                 blank=True,
                                                 null=True)
    parent_guardian_first_name = models.CharField(max_length=150, blank=True)
    parent_guardian_last_name = models.CharField(max_length=150, blank=True)
    relationship_to_student = models.CharField(max_length=500, blank=True)
    heard_about_us = models.ForeignKey(
        HeardAboutUsOption,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    from_online_inquiry = models.BooleanField(default=False, )
    first_contact = models.ForeignKey(
        FirstContactOption,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    borough = models.ForeignKey(
        BoroughOption,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    country_of_birth = models.ForeignKey(
        CountryOption,
        blank=True,
        null=True,
        default=get_default_country,
        on_delete=models.SET_NULL,
    )
    immigration_status = models.ForeignKey(
        ImmigrationOption,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    ready_for_export = models.BooleanField(default=False, )
    sis_student = models.OneToOneField('sis.Student',
                                       blank=True,
                                       null=True,
                                       related_name="appl_student",
                                       on_delete=models.SET_NULL)

    total_income = models.DecimalField(max_digits=10,
                                       decimal_places=2,
                                       blank=True,
                                       null=True)
    adjusted_available_income = models.DecimalField(max_digits=10,
                                                    decimal_places=2,
                                                    blank=True,
                                                    null=True)
    calculated_payment = models.DecimalField(max_digits=10,
                                             decimal_places=2,
                                             blank=True,
                                             null=True)

    date_added = models.DateField(auto_now_add=True,
                                  blank=True,
                                  null=True,
                                  validators=settings.DATE_VALIDATORS)
    level = models.ForeignKey(AdmissionLevel,
                              blank=True,
                              null=True,
                              on_delete=models.SET_NULL)
    checklist = models.ManyToManyField(AdmissionCheck, blank=True, null=True)
    application_decision = models.ForeignKey(
        ApplicationDecisionOption,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    application_decision_by = models.ForeignKey(
        User,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    withdrawn = models.ForeignKey(
        WithdrawnChoices,
        blank=True,
        null=True,
        on_delete=models.SET_NULL,
    )
    withdrawn_note = models.CharField(max_length=500, blank=True)
    first_to_college = models.BooleanField(default=False, blank=True)
    individual_education_plan = models.BooleanField(default=False, blank=True)
    lives_with = models.CharField(
        blank=True,
        max_length=50,
        choices=(
            ('Both Parents', 'Both Parents'),
            ('Mother', 'Mother'),
            ('Father', 'Father'),
            ('Guardian(s)', 'Guardian(s)'),
        ),
    )

    class Meta:
        ordering = (
            'lname',
            'fname',
        )

    def __unicode__(self):
        return "%s %s %s" % (self.fname, self.mname, self.lname)

    @property
    def parent_guardian(self):
        """ Compatibility to act like sis.student parent_guardian
        """
        return u"{} {}".format(self.parent_guardian_first_name,
                               self.parent_guardian_last_name)

    def set_cache(self, contact):
        self.parent_guardian_first_name = contact.fname
        self.parent_guardian_last_name = contact.lname
        self.street = contact.street
        self.state = contact.state
        self.zip = contact.zip
        self.city = contact.city
        self.parent_email = contact.email
        self.save()

        for contact in self.parent_guardians.exclude(id=contact.id):
            # There should only be one primary contact!
            if contact.primary_contact:
                contact.primary_contact = False
                contact.save()

    def __set_level(self):
        prev = None
        for level in AdmissionLevel.objects.all():
            checks = level.admissioncheck_set.filter(required=True)
            i = 0
            for check in checks:
                if check in self.checklist.all():
                    i += 1
            if not i >= checks.count():
                break
            prev = level
        self.level = prev

    def save(self, *args, **kwargs):
        if self.id:
            self.__set_level()
        # create contact log entry on application decision
        if self.application_decision and self.id:
            old = Applicant.objects.get(id=self.id)
            if not old.application_decision:
                contact_log = ContactLog(user=self.application_decision_by,
                                         applicant=self,
                                         note="Application Decision: %s" %
                                         (self.application_decision, ))
                contact_log.save()
        super(Applicant, self).save(*args, **kwargs)
Beispiel #4
0
class Migration(migrations.Migration):

    dependencies = [
        ("taxtea", "0002_auto_20200421_2250"),
    ]

    operations = [
        migrations.AlterField(
            model_name="state",
            name="abbreviation",
            field=localflavor.us.models.USStateField(
                help_text="Abbreviation of State -> NY",
                max_length=2,
                primary_key=True,
                serialize=False,
            ),
        ),
        migrations.AlterField(
            model_name="state",
            name="collects_saas_tax",
            field=models.BooleanField(
                default=False, help_text="If the State collects SaaS Tax"),
        ),
        migrations.AlterField(
            model_name="state",
            name="tax_base",
            field=models.CharField(
                choices=[
                    ("ORIGIN", "Origin-based"),
                    ("DESTINATION", "Destination-based"),
                ],
                default="DESTINATION",
                help_text="SaaS Tax Collection Method",
                max_length=30,
            ),
        ),
        migrations.AlterField(
            model_name="zipcode",
            name="code",
            field=models.CharField(
                help_text="The 5 digit Zip Code",
                max_length=9,
                primary_key=True,
                serialize=False,
            ),
        ),
        migrations.AlterField(
            model_name="zipcode",
            name="last_checked",
            field=models.DateTimeField(
                blank=True,
                help_text=
                "DateTime of the last time the tax rate was refreshed",
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="zipcode",
            name="state",
            field=models.ForeignKey(
                help_text="Foreign Key to the State the ZipCode is in",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="zipcodes",
                to="taxtea.State",
            ),
        ),
        migrations.AlterField(
            model_name="zipcode",
            name="tax_rate",
            field=models.DecimalField(
                blank=True,
                decimal_places=4,
                help_text="Tax Rate for the given ZipCode -> 0.0625",
                max_digits=5,
                null=True,
            ),
        ),
    ]