Skip to main content

django-results

提供django下结果页

Quick start

  1. Install:

    pip install django_results
  2. Add “results” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'results',
    ]
  3. No Migrations

  4. Create results view:

    # config in urls
    from results.views import ResultView
    from sample import views as sample_views
    urlpatterns = [
        url(r'^$', TemplateView.as_view(template_name='sample/index.html')),
    
        url('^result-view-class/$',
            ResultView.as_view(template_name='results/result.html',
                               title='sample出错标题',
                               message='sample出错信息',
                               type='info'),
            name='result_view_class'),
    
        url(r'^form-error/$', sample_views.form_error_view, name='form_error'),
    
        url(r'^error-result/$', ResultView.error_view, dict(title='出错标题', message='ResultView.error_view'),
            name='error_result'),
        url(r'^error-result/object-does-not-exist/$', ResultView.error_view, dict(error=ObjectDoesNotExist()),
            name='error_result_object_does_not_exist'),
    
        url(r'^result-view/success/$',
            ResultView.success_view,
            {"title": "success的标题", "message": "success的消息"}, name='result_view_success'),
        url(r'^result-view/danger/$',
            ResultView.error_view,
            {"title": "danger的标题", "message": "danger的消息"}, name='result_view_danger'),
        url(r'^result-view/info/$',
            ResultView.info_view,
            {"title": "info的标题", "message": "info的消息"}, name='result_view_info'),
    ]
    
    # handle form error in views
    def form_error_view(request):
        class TestForm(forms.Form):
            required_field = forms.CharField(required=True)
    
            invalid_field = forms.CharField(max_length=1)
    
            def clean(self):
                raise forms.ValidationError('non field error happened')
    
        form = TestForm(data={'invalid_field': 'xxxxx'})
    
        return ResultView.error_view(request, title='这里有一个错误', message='不知道当讲不当讲,算了我还是讲了', error=form.errors)

Metadata

Release files for django-results 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-results 0.5.1
File Size Uploaded Provenance Actions
django-results-0.5.1.tar.gz 5.3 kB Without provenance Details for django-results-0.5.1.tar.gz

Release files / django-results-0.5.1.tar.gz

Download URL django-results-0.5.1.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
67bec533dd8e78ae942107efbe4da3703b35ddc7a87af040db92b120cd83206e
BLAKE2b-256 checksum
How to use checksums
97efad47b9051e07a412fe74944df67c2e5782156061b859abe657434aa05fc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-results 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page