예제 #1
0
    def generate_periods(self):
        cycle_1_start = 0
        cycle_1_value = simplify(self.birth.month)
        cycle_1_example = examplify(
            tranz("g.month"),
            "%02d" % self.birth.month,
            cycle_1_value
        )

        cycle_2_start = 28
        cycle_2_value = simplify(self.birth.day)
        cycle_2_example = examplify(
            tranz("g.day"),
            "%02d" % self.birth.day,
            cycle_2_value
        )

        cycle_3_start = 56
        cycle_3_value = simplify(self.birth.year)
        cycle_3_example = examplify(
            tranz("g.year"),
            "%04d" % self.birth.year,
            cycle_3_value
        )

        periods = [
            create_period(cycle_1_start, cycle_1_value, cycle_1_example),
            create_period(cycle_2_start, cycle_2_value, cycle_2_example),
            create_period(cycle_3_start, cycle_3_value, cycle_3_example)
        ]

        return periods
예제 #2
0
    def run(self):
        year, month, day = self.today.year + 1, self.birth.month, self.birth.day
        num = utils.simplify(year + month + day, keep_power=False)
        self._result = num

        # Compute the example
        formatted_birth = "%s + %s + %s" % (tranz("g.u_year"),
                                            tranz("g.month"), tranz("g.day"))
        formatted_sum = "%04d + %02d + %02d" % (year, month, day)
        self._example = utils.examplify(formatted_birth, formatted_sum,
                                        self._result)
예제 #3
0
    def run(self):
        year, month, day = self.birth.year, self.birth.month, self.birth.day
        num = utils.simplify(year + month + day)
        if num not in POWERS:
            # Try another way to find the power number
            num = utils.simplify(
                utils.simplify(year, keep_power=False) +
                utils.simplify(month, keep_power=False) +
                utils.simplify(day, keep_power=False))
        self._result = num

        # Compute the example
        formatted_birth = "%s + %s + %s" % (tranz("g.year"), tranz("g.month"),
                                            tranz("g.day"))
        formatted_sum = "%04d + %02d + %02d" % (year, month, day)
        self._example = utils.examplify(formatted_birth, formatted_sum,
                                        self._result)
예제 #4
0
def months_full():
    """ Display the full name of months for JS, translated
    """
    prefix = 'g.months.full.'
    months = []
    for i in range(1, 13):
        month_name = prefix + str(i)
        months.append(tranz(month_name))
    return {'months': months}
예제 #5
0
def weekdays_full():
    """ Display the full name of days for JS, translated
    """
    prefix = 'g.days.full.'
    days = []
    for i in range(1, 8):
        day_name = prefix + str(i)
        days.append(tranz(day_name))
    return {'days': days}
예제 #6
0
    def generate_periods(self):
        """ Return the periods and content of the actions """

        life_path = LifePath(self.person).result
        life_path = simplify(life_path, keep_power=False)

        action_1_start = 0
        action_1_value = simplify(self.birth.month + self.birth.day)
        action_1_example = examplify(
            "%s + %s" % (tranz("g.month"), tranz("g.day")),
            "%02d + %02d" % (self.birth.month, self.birth.day),
            action_1_value
        )

        action_2_start = 36 - life_path
        action_2_value = simplify(self.birth.year + self.birth.day)
        action_2_example = examplify(
            "%s + %s" % (tranz("g.year"), tranz("g.day")),
            "%04d + %02d" % (self.birth.year, self.birth.day),
            action_2_value
        )

        action_3_start = action_2_start + 9
        action_3_value = simplify(
            simplify(action_1_value, keep_power=False) +
            simplify(action_2_value, keep_power=False)
        )
        action_3_example = examplify(
            "%s + %s" % (tranz("g.action_1"), tranz("g.action_2")),
            "%d + %d" % (action_1_value, action_2_value),
            action_3_value
        )

        action_4_start = action_3_start + 9
        action_4_value = simplify(self.birth.year + self.birth.month)
        action_4_example = examplify(
            "%s + %s" % (tranz("g.year"), tranz("g.month")),
            "%04d + %02d" % (self.birth.year, self.birth.month),
            action_4_value
        )

        periods = [
            create_period(action_1_start, action_1_value, action_1_example),
            create_period(action_2_start, action_2_value, action_2_example),
            create_period(action_3_start, action_3_value, action_3_example),
            create_period(action_4_start, action_4_value, action_4_example),
        ]
        return periods
예제 #7
0
class PersonDeleteView(DeleteView):

    model = models.Person
    template_name = "calculator/person_delete.djt"
    title = tranz("page.titles.person_delete")
    success_url = reverse_lazy("calc:people")
예제 #8
0
class PersonDetailView(DetailView):

    model = models.Person
    template_name = "calculator/person.djt"
    title = tranz("page.titles.person_detail")
예제 #9
0
class PersonListView(ListView):

    model = models.Person
    template_name = "calculator/person_list.djt"
    title = tranz("page.titles.person_list")