{"id":27940489,"url":"https://github.com/cordery/django-conditional-views","last_synced_at":"2025-05-07T10:17:11.601Z","repository":{"id":49710071,"uuid":"146948850","full_name":"cordery/django-conditional-views","owner":"cordery","description":"Simple Etag and Last-Modified mixins for class based views.","archived":false,"fork":false,"pushed_at":"2021-06-10T17:35:24.000Z","size":67,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-05T02:03:48.025Z","etag":null,"topics":["class-based-views","django","etag","http-header","last-modified"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cordery.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-31T22:49:12.000Z","updated_at":"2023-04-11T12:10:22.000Z","dependencies_parsed_at":"2022-09-05T02:51:22.416Z","dependency_job_id":null,"html_url":"https://github.com/cordery/django-conditional-views","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordery%2Fdjango-conditional-views","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordery%2Fdjango-conditional-views/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordery%2Fdjango-conditional-views/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordery%2Fdjango-conditional-views/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cordery","download_url":"https://codeload.github.com/cordery/django-conditional-views/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252856565,"owners_count":21814858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["class-based-views","django","etag","http-header","last-modified"],"created_at":"2025-05-07T10:17:09.020Z","updated_at":"2025-05-07T10:17:11.322Z","avatar_url":"https://github.com/cordery.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Django Conditional Views\n########################\n\n.. image:: https://circleci.com/gh/cordery/django-conditional-views.svg?style=svg\n  :target: https://circleci.com/gh/cordery/django-conditional-views\n  :alt: Build Status\n\n\n.. image:: https://codecov.io/gh/cordery/django-conditional-views/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/cordery/django-conditional-views\n  :alt: Test Coverage\n\n\n.. image:: https://readthedocs.org/projects/django-conditional-views/badge/?version=latest\n  :target: https://django-conditional-views.readthedocs.io/en/latest/?badge=latest\n  :alt: Documentation Status\n\n\n.. image:: https://img.shields.io/github/license/cordery/django-conditional-views.svg\n  :alt: MIT License\n\n\nSimple ETag and Last-Modified mixins for class based views.\n\n\nWhat is Django Conditional Views?\n==================================\n\nDjango Conditional Views builds off of the built in `django conditional view processing`_ machinery\nto provide simple mixins for class based views that implement support for the ETag and Last-Modified\nconditional request headers.\n\n.. _django conditional view processing: https://docs.djangoproject.com/en/2.1/topics/conditional-view-processing/\n\n\nFeatures\n========\n\nInherit one of these mixins to make your TemplateView's, DetailView's, or ListView's:\n\n  1. Calculate and append ETag and/or Last-Modified headers to the response and;\n\n  2. Respond with a `304 Not Modified`_ or a `412 Precondition Failed`_ to requests that provide conditional response headers such as If-Modified-Since\n\n.. _304 Not Modified: https://tools.ietf.org/html/rfc7232#section-4.1\n.. _412 Precondition Failed: https://tools.ietf.org/html/rfc7232#section-4.2\n\n**Helpful Defaults**\n  * ETags are automatically generated from the response.content.\n  * ETag generation can be customized both before and after the response is rendered.\n  * The Last Modified header is automatically set from the last modified timestamp of the template.\n  * In the case of the DetailView and ListView mixins, the Last Modified header may also be\n    configured to get the last modification timestamp from a field on the model, in which case\n    the lastest of that or the template's last modified timestamp will be used.\n\n\n\nGetting Started\n===============\n\n\nFirst install django-conditional-views\n\n.. code-block:: bash\n\n  $ pip install django-conditional-views\n\nThen inherit from one of the following mixins in your views:\n\n* ConditionalGetMixin - Inherits from View\n* ConditionalGetTemplateViewMixin - Inherits from TemplateView\n* ConditionalGetListViewMixin - Inherits from ListView\n* ConditionalGetDetailViewMixin - Inherits from DetailView\n\nSee the Usage_ and API_ sections of the documentation_ for more details.\n\n.. _Usage: https://django-conditional-views.readthedocs.io/en/latest/usage.html\n.. _API: https://django-conditional-views.readthedocs.io/en/latest/api.html\n.. _documentation: https://django-conditional-views.readthedocs.io/en/latest/\n\nContributing\n============\n\nContributions are welcome.\n\n\nGetting Started\n---------------\n\nTo work on the Pendulum codebase, you'll want to clone the project locally\nand install the required dependencies via `poetry \u003chttps://poetry.eustace.io\u003e`_.\n\n.. code-block:: bash\n\n    $ git clone git@github.com:cordery/django-conditional-views.git\n    $ poetry develop\n\n\nRunning Tests\n---------------\ndjango-conditional-views uses pytest.  To run tests:\n\n.. code-block:: bash\n\n  $ pytest\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcordery%2Fdjango-conditional-views","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcordery%2Fdjango-conditional-views","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcordery%2Fdjango-conditional-views/lists"}