当前位置: 首页>>代码示例>>Python>>正文


Python Reuse.objects方法代码示例

本文整理汇总了Python中udata.models.Reuse.objects方法的典型用法代码示例。如果您正苦于以下问题:Python Reuse.objects方法的具体用法?Python Reuse.objects怎么用?Python Reuse.objects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在udata.models.Reuse的用法示例。


在下文中一共展示了Reuse.objects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_context

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
    def get_context(self):
        context = super(OrganizationDetailView, self).get_context()

        can_edit = EditOrganizationPermission(self.organization)
        can_view = OrganizationPrivatePermission(self.organization)

        if self.organization.deleted and not can_view.can():
            abort(410)

        datasets = Dataset.objects(organization=self.organization).order_by('-temporal_coverage.end', '-metrics.reuses', '-metrics.followers').visible()
        reuses = Reuse.objects(organization=self.organization).order_by('-metrics.reuses', '-metrics.followers').visible()
        followers = (Follow.objects.followers(self.organization)
                                   .order_by('follower.fullname'))
        context.update({
            'reuses': reuses.paginate(1, self.page_size),
            'datasets': datasets.paginate(1, self.page_size),
            'followers': followers,
            'can_edit': can_edit,
            'can_view': can_view,
            'private_reuses': (
                list(Reuse.objects(organization=self.object).hidden())
                if can_view else []),
            'private_datasets': (
                list(Dataset.objects(organization=self.object).hidden())
                if can_view else []),
        })
        return context
开发者ID:odtvince,项目名称:udata,代码行数:29,代码来源:views.py

示例2: get_context

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
 def get_context(self):
     context = super(OrganizationIssuesView, self).get_context()
     datasets = Dataset.objects(organization=self.organization)
     reuses = Reuse.objects(organization=self.organization)
     ids = [o.id for o in list(datasets) + list(reuses)]
     context['issues'] = Issue.objects(subject__in=ids)
     return context
开发者ID:grouan,项目名称:udata,代码行数:9,代码来源:views.py

示例3: get_context

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
    def get_context(self):
        context = super(OrganizationDetailView, self).get_context()

        org_id = str(self.organization.id)
        datasets, supplied_datasets, reuses = search.multiquery(
            search.SearchQuery(Dataset, sort='-created', organization=org_id, page_size=9),
            search.SearchQuery(Dataset, sort='-created', supplier=org_id, page_size=9),
            search.SearchQuery(Reuse, sort='-created', organization=org_id, page_size=9),

        )
        followers = FollowOrg.objects.followers(self.organization).order_by('follower.fullname')

        can_edit = EditOrganizationPermission(self.organization.id)
        context.update({
            'reuses': reuses,
            'datasets': datasets,
            'supplied_datasets': supplied_datasets,
            'followers': followers[:self.nb_followers],
            'can_edit': can_edit
        })
        if can_edit:
            context.update({
                'private_reuses': list(Reuse.objects(organization=self.object, private=True)),
                'private_datasets': list(Dataset.objects(organization=self.object, private=True)),
            })

        return context
开发者ID:pombredanne,项目名称:udata,代码行数:29,代码来源:views.py

示例4: aggregate_reuses_daily

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
def aggregate_reuses_daily(org, day):
    keys = ['reuses_{0}'.format(k) for k in KEYS]
    ids = [r.id for r in Reuse.objects(organization=org).only('id')]
    metrics = Metrics.objects(object_id__in=ids,
                              level='daily', date=day.isoformat())
    values = [int(metrics.sum('values.{0}'.format(k))) for k in KEYS]
    Metrics.objects.update_daily(org, day, **dict(zip(keys, values)))
开发者ID:noirbizarre,项目名称:udata-piwik,代码行数:9,代码来源:metrics.py

示例5: home

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
def home():
    context = {
        'recent_datasets': Dataset.objects.visible(),
        'recent_reuses': Reuse.objects(featured=True).visible(),
        'last_post': Post.objects(private=False).first(),
    }
    processor = theme.current.get_processor('home')
    context = processor(context)
    return theme.render('home.html', **context)
开发者ID:anukat2015,项目名称:udata,代码行数:11,代码来源:views.py

示例6: dataconnexions5

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
def dataconnexions5():
    reuses = Reuse.objects(badges__kind=DATACONNEXIONS_5_CANDIDATE).visible()

    categories = [{
        'tag': tag,
        'label': label,
        'description': description,
        'reuses': reuses(tags=tag),
    } for tag, label, description in DATACONNEXIONS_5_CATEGORIES]
    return theme.render('dataconnexions-5.html', categories=categories)
开发者ID:opendatalu,项目名称:udata-gouvlu,代码行数:12,代码来源:views.py

示例7: explore

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
def explore():
    recent_datasets = list(Dataset.objects.visible().order_by('-date').limit(9))
    recent_reuses = list(Reuse.objects.order_by('-date').limit(9))
    featured_datasets = list(Dataset.objects(featured=True).visible().order_by('-date').limit(15))
    featured_reuses = list(Reuse.objects(featured=True).order_by('-date').limit(15))

    return render('explore.html',
        recent_datasets=recent_datasets,
        recent_reuses=recent_reuses,
        featured_datasets=featured_datasets,
        featured_reuses=featured_reuses,
    )
开发者ID:rossjones,项目名称:udata,代码行数:14,代码来源:explore.py

示例8: dataconnexions6

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
def dataconnexions6():
    # Use tags until we are sure all reuse are correctly labeled
    # reuses = Reuse.objects(badges__kind=DATACONNEXIONS_6_CANDIDATE)
    reuses = Reuse.objects(tags='dataconnexions-6').visible()

    categories = [{
        'tag': tag,
        'label': label,
        'description': description,
        'reuses': reuses(tags=tag),
    } for tag, label, description in DATACONNEXIONS_6_CATEGORIES]
    return theme.render('dataconnexions-6.html', categories=categories)
开发者ID:opendatalu,项目名称:udata-gouvlu,代码行数:14,代码来源:views.py

示例9: get_context

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
    def get_context(self):
        context = super(OrganizationDetailView, self).get_context()

        datasets = Dataset.objects(organization=self.organization).visible().order_by('-created')
        supplied_datasets = Dataset.objects(supplier=self.organization).visible().order_by('-created')
        reuses = Reuse.objects(organization=self.organization).visible().order_by('-created')
        followers = FollowOrg.objects.followers(self.organization).order_by('follower.fullname')

        can_edit = EditOrganizationPermission(self.organization)
        can_view = OrganizationPrivatePermission(self.organization)
        context.update({
            'reuses': reuses.paginate(1, self.page_size),
            'datasets': datasets.paginate(1, self.page_size),
            'supplied_datasets': supplied_datasets[:self.page_size],
            'followers': followers[:self.nb_followers],
            'can_edit': can_edit,
            'can_view': can_view,
            'private_reuses': list(Reuse.objects(organization=self.object).hidden()) if can_view else [],
            'private_datasets': list(Dataset.objects(organization=self.object).hidden()) if can_view else [],
        })

        return context
开发者ID:guillo-w,项目名称:udata,代码行数:24,代码来源:views.py

示例10: get_context

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
 def get_context(self):
     context = super(DatasetDetailView, self).get_context()
     if not DatasetEditPermission(self.dataset).can():
         if self.dataset.private:
             abort(404)
         elif self.dataset.deleted:
             abort(410)
     context['reuses'] = Reuse.objects(datasets=self.dataset).visible()
     context['can_edit'] = DatasetEditPermission(self.dataset)
     context['can_edit_resource'] = ResourceEditPermission
     context['discussions'] = DatasetDiscussion.objects(
         subject=self.dataset)
     return context
开发者ID:javanna2000,项目名称:udata,代码行数:15,代码来源:views.py

示例11: get_context

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
    def get_context(self):
        context = super(OrganizationDetailView, self).get_context()

        can_edit = EditOrganizationPermission(self.organization)
        can_view = OrganizationPrivatePermission(self.organization)

        if self.organization.deleted and not can_view.can():
            abort(410)

        datasets = Dataset.objects(organization=self.organization).visible()
        reuses = Reuse.objects(organization=self.organization).visible()
        followers = FollowOrg.objects.followers(self.organization).order_by("follower.fullname")
        context.update(
            {
                "reuses": reuses.paginate(1, self.page_size),
                "datasets": datasets.paginate(1, self.page_size),
                "followers": followers,
                "can_edit": can_edit,
                "can_view": can_view,
                "private_reuses": (list(Reuse.objects(organization=self.object).hidden()) if can_view else []),
                "private_datasets": (list(Dataset.objects(organization=self.object).hidden()) if can_view else []),
            }
        )
        return context
开发者ID:opendatalu,项目名称:udata,代码行数:26,代码来源:views.py

示例12: get_context

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
    def get_context(self):
        context = super(OrganizationDetailView, self).get_context()

        org_id = str(self.organization.id)
        datasets, supplied_datasets, reuses = multiquery(
            SearchQuery(DatasetSearch, sort='-created', organization=org_id, page_size=9),
            SearchQuery(DatasetSearch, sort='-created', supplier=org_id, page_size=9),
            SearchQuery(ReuseSearch, sort='-created', organization=org_id, page_size=9),
        )

        context.update({
            'reuses': reuses,
            'datasets': datasets,
            'supplied_datasets': supplied_datasets,
            'private_reuses': list(Reuse.objects(organization=self.object, private=True)),
            'private_datasets': list(Dataset.objects(organization=self.object, private=True)),
            'can_edit': EditOrganizationPermission(self.organization.id)
        })

        return context
开发者ID:rossjones,项目名称:udata,代码行数:22,代码来源:views.py

示例13: get_value

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
 def get_value(self):
     return Reuse.objects(owner=self.user).count()
开发者ID:odtvince,项目名称:udata,代码行数:4,代码来源:metrics.py

示例14: get_value

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
 def get_value(self):
     ids = [d.id for d in
            (Reuse.objects(organization=self.target).only('id') or [])]
     return int(Metrics.objects(object_id__in=ids, level='daily')
                       .sum('values.nb_uniq_visitors'))
开发者ID:noirbizarre,项目名称:udata-piwik,代码行数:7,代码来源:metrics.py

示例15: get_value

# 需要导入模块: from udata.models import Reuse [as 别名]
# 或者: from udata.models.Reuse import objects [as 别名]
 def get_value(self):
     reuse = Reuse.objects(metrics__datasets__gt=0).visible().order_by('-metrics.datasets').first()
     return reuse.metrics.get('datasets', 0)
开发者ID:guillo-w,项目名称:udata,代码行数:5,代码来源:metrics.py


注:本文中的udata.models.Reuse.objects方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。