示例#1
0
文件: admin.py 项目: torhhu/turkle
class TurkleAdminSite(admin.AdminSite):
    app_index_template = 'admin/turkle/app_index.html'
    site_header = get_site_name() + ' administration'
    site_title = get_site_name() + ' site admin'

    def about(self, request):
        return render(request, 'admin/turkle/about.html', {
            'title': 'About',
            'site_title': self.site_title,
            'site_header': self.site_header,
            'version': turkle.__version__,
        })

    def expire_abandoned_assignments(self, request):
        (total_deleted, _) = TaskAssignment.expire_all_abandoned()
        messages.info(request, 'All {} abandoned Tasks have been expired'.format(total_deleted))
        return redirect(reverse('turkle_admin:index'))

    def get_urls(self):
        urls = super().get_urls()
        my_urls = [
            url(r'^about/$', self.admin_view(self.about), name='about'),
            url(r'^expire_abandoned_assignments/$',
                self.admin_view(self.expire_abandoned_assignments),
                name='expire_abandoned_assignments'),
        ]
        return my_urls + urls
示例#2
0
class TurkleAppConfig(AppConfig):
    name = 'turkle'
    verbose_name = get_site_name()
示例#3
0
文件: admin.py 项目: lanwuwei/turkle
class TurkleAdminSite(admin.AdminSite):
    app_index_template = 'admin/turkle/app_index.html'
    site_header = get_site_name() + ' administration'
    site_title = get_site_name() + ' site admin'