Esempio n. 1
0
 def test_until_date(self):
     m = MemberGroupMembership(
         group=self.testcie,
         member=self.testuser,
         until=timezone.now().date().replace(year=2000),
         chair=False,
     )
     with self.assertRaises(ValidationError):
         m.clean()
     m.since = timezone.now().date().replace(year=1900)
     m.clean()
Esempio n. 2
0
    def create_member_group_membership(self, member, group):
        """
        Create member group membership

        :param member: the member to add to the committee
        :param group: the group to add the member to
        """
        membership = MemberGroupMembership()

        membership.member = member
        membership.group = group

        today = date.today()
        month = timedelta(days=30)
        membership.since = _faker.date_time_between_dates(
            group.since, today + month).date()

        if random.random() < 0.2 and membership.since < today:
            membership.until = _faker.date_time_between_dates(
                membership.since, today).date()

        membership.save()