コード例 #1
0
ファイル: legislation.py プロジェクト: eaudeweb/lcc-toolkit
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     countries = sorted(models.Country.objects.all(), key=lambda c: c.name)
     context.update({
         "countries":
         countries,
         "available_languages":
         constants.ALL_LANGUAGES,
         "legislation_type":
         constants.LEGISLATION_TYPE,
         "tag_groups": [
             TagGroupRender(tag_group)
             for tag_group in models.TaxonomyTagGroup.objects.all()
         ],
         "classifications":
         models.TaxonomyClassification.objects.filter(
             level=0).order_by("code"),
         "adoption_years":
         LEGISLATION_YEAR_RANGE,
         "source_types":
         constants.SOURCE_TYPE,
         "geo_coverage":
         constants.GEOGRAPHICAL_COVERAGE,
     })
     return context
コード例 #2
0
ファイル: articles.py プロジェクト: eaudeweb/lcc-toolkit
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     article = self.get_object()
     context.update({
         "starting_page": article.legislation_page,
         "law": article.legislation,
         "selected_tags": [tag.name for tag in article.tags.all()],
         "selected_classifications": [
             classification.name
             for classification in article.classifications.all()
         ],
         "tag_groups": [
             TagGroupRender(tag_group)
             for tag_group in models.TaxonomyTagGroup.objects.all()
         ],
         "classifications": models.TaxonomyClassification.objects.filter(
             level=0).order_by('code')
     })
     return context
コード例 #3
0
ファイル: articles.py プロジェクト: eaudeweb/lcc-toolkit
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        last_article = self.law.articles.order_by('pk').last() \
            if self.law.articles else None
        starting_page = last_article.legislation_page if last_article else 1

        context.update(
            {
                'law': self.law,
                "starting_page": starting_page,
                "last_article": last_article,
                "add_article": True,
                "tag_groups": [
                    TagGroupRender(tag_group)
                    for tag_group in models.TaxonomyTagGroup.objects.all()
                ],
                "classifications":
                    models.TaxonomyClassification.objects.filter(
                        level=0).order_by('code')
            }
        )
        return context
コード例 #4
0
ファイル: sections.py プロジェクト: eaudeweb/lcc-toolkit
    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        last_section = (self.law.sections.order_by("pk").last()
                        if self.law.sections else None)
        starting_page = last_section.legislation_page if last_section else 1

        context.update({
            "law":
            self.law,
            "starting_page":
            starting_page,
            "last_section":
            last_section,
            "add_section":
            True,
            "tag_groups": [
                TagGroupRender(tag_group)
                for tag_group in models.TaxonomyTagGroup.objects.all()
            ],
            "classifications":
            models.TaxonomyClassification.objects.filter(
                level=0).order_by("code"),
        })
        return context