示例#1
0
class Attribution(SerializableModel):
    external_id = models.CharField(max_length=100,
                                   blank=True,
                                   null=True,
                                   db_index=True)
    changed = models.DateTimeField(null=True, auto_now=True)
    start_date = models.DateField(auto_now=False,
                                  blank=True,
                                  null=True,
                                  auto_now_add=False)
    end_date = models.DateField(auto_now=False,
                                blank=True,
                                null=True,
                                auto_now_add=False)
    start_year = models.IntegerField(blank=True, null=True)
    end_year = models.IntegerField(blank=True, null=True)
    function = models.CharField(max_length=35,
                                blank=True,
                                null=True,
                                choices=Functions.choices(),
                                db_index=True)
    learning_unit_year = models.ForeignKey('base.LearningUnitYear',
                                           on_delete=models.CASCADE)
    tutor = models.ForeignKey('base.Tutor', on_delete=models.CASCADE)
    score_responsible = models.BooleanField(default=False)
    summary_responsible = models.BooleanField(default=False)

    def __str__(self):
        return u"%s - %s" % (self.tutor.person, self.get_function_display())

    @property
    def duration(self):
        if self.start_year and self.end_year:
            return (self.end_year - self.start_year) + 1
        return None
示例#2
0
class AttributionNew(models.Model):
    external_id = models.CharField(max_length=100,
                                   blank=True,
                                   null=True,
                                   db_index=True)
    changed = models.DateTimeField(null=True, auto_now=True)
    learning_container_year = models.ForeignKey('base.LearningContainerYear')
    tutor = models.ForeignKey('base.Tutor')
    function = models.CharField(max_length=35,
                                choices=Functions.choices(),
                                db_index=True,
                                verbose_name=_("Function"))
    start_date = models.DateField(blank=True, null=True)
    end_date = models.DateField(blank=True, null=True)
    start_year = models.IntegerField(blank=True,
                                     null=True,
                                     verbose_name=_("Start"))
    end_year = models.IntegerField(blank=True, null=True)
    score_responsible = models.BooleanField(default=False)
    substitute = models.ForeignKey('base.Person', blank=True, null=True)

    def __str__(self):
        return u"%s - %s" % (self.tutor.person, self.function)

    @property
    def duration(self):
        if self.start_year and self.end_year:
            return (self.end_year - self.start_year) + 1
        return None
示例#3
0
class TutorApplication(models.Model):
    external_id = models.CharField(max_length=100,
                                   blank=True,
                                   null=True,
                                   db_index=True)
    changed = models.DateTimeField(null=True, auto_now=True)
    learning_container_year = models.ForeignKey('base.LearningContainerYear')
    tutor = models.ForeignKey('base.Tutor')
    function = models.CharField(max_length=35,
                                blank=True,
                                null=True,
                                choices=Functions.choices(),
                                db_index=True)
    volume_lecturing = models.DecimalField(max_digits=6,
                                           decimal_places=1,
                                           blank=True,
                                           null=True)
    volume_pratical_exercice = models.DecimalField(max_digits=6,
                                                   decimal_places=1,
                                                   blank=True,
                                                   null=True)
    remark = models.TextField(blank=True, null=True)
    course_summary = models.TextField(blank=True, null=True)
    last_changed = models.DateTimeField(null=True)

    def __str__(self):
        return u"%s - %s" % (self.tutor, self.function)
示例#4
0
class AttributionNewFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = "attribution.AttributionNew"

    external_id = factory.fuzzy.FuzzyText(length=10, chars=string.digits)
    changed = fake.date_time_this_decade(before_now=True, after_now=True, tzinfo=get_tzinfo())
    start_date = None
    end_date = None
    start_year = None
    end_year = None
    function = factory.Iterator(Functions.choices(), getter=lambda c: c[0])
    tutor = factory.SubFactory(TutorFactory)
    score_responsible = False
    learning_container_year = factory.SubFactory(LearningContainerYearFactory)
示例#5
0
class TutorApplicationFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = "attribution.TutorApplication"

    external_id = factory.fuzzy.FuzzyText(length=10, chars=string.digits)
    changed = fake.date_time_this_decade(before_now=True,
                                         after_now=True,
                                         tzinfo=get_tzinfo())
    function = factory.Iterator(Functions.choices(), getter=lambda c: c[0])
    tutor = factory.SubFactory(TutorFactory)
    learning_container_year = factory.SubFactory(LearningContainerYearFactory)
    volume_lecturing = factory.fuzzy.FuzzyDecimal(99)
    volume_pratical_exercice = factory.fuzzy.FuzzyDecimal(99)
    last_changed = factory.fuzzy.FuzzyNaiveDateTime(
        datetime.datetime(2016, 1, 1), datetime.datetime(2017, 3, 1))