A feature flipper for Django

Related tags

Django django-waffle
Overview
Comments
  • Added autocreate settings to fix #44

    Added autocreate settings to fix #44

    This patch makes it possible for Waffles to automatically create switches upon usage so you don't have to manually create them.

    This fixes ticket https://github.com/jsocol/django-waffle/issues/44

    opened by wolph 22
  • Django 3 support.

    Django 3 support.

    Closes #354.

    Django 3 "remove[s] private Python 2 compatibility APIs", which is to say it removes a number of utility methods that were either already provided by six or otherwise were used in bridging the old and the new python. This pull request makes django-waffle work with Django 3 by making just 3 changes.

    1. Add six to the requirements.
    2. Replace the result of callingavailable_attrs with functools.WRAPPER_ASSIGNMENTS (cf https://docs.djangoproject.com/en/2.2/_modules/django/utils/decorators/)
    3. Use the python_2_unicode_compatible provided by six rather than the one vendored with django.

    Not sure what the protocol is on bumping the version and amending the changelog; would be happy to do both.

    opened by heydenberk 21
  • Ensure flags, switches, and samples are read from write DB

    Ensure flags, switches, and samples are read from write DB

    In an environment with sufficiently high traffic and DB replication set up, there is a race condition with switches and samples where when an update is immediately followed by a read, the read will get a stale value from the DB replica and cache it.

    This fixes the race condition by ensuring that switches and samples are always read from the write DB.

    opened by dtao 18
  • Django 1.7 compatibility

    Django 1.7 compatibility

    • Export signals handling to models.py
    • Export all settings to one unique file
    • Export keyfmt to utils.py
    • We are not importing models anymore in init.py which can cause in several cases multiple fails from django.apps Registry
    • Refactor unittests using django own DiscoverRunner

    Currently all tests pass except SwitchTests.test_no_query which I'm missing something why we should make on query as we don't cache query from Django itself (we only cache proxies from waffle.__init__.py).

    I'm available if you want more information.

    This PR is currently under development and not available to merge btw.

    opened by thoas 15
  • Fix Django 1.5 User model importing

    Fix Django 1.5 User model importing

    I get a circular import problem in my Django 1.5 app caused by waffle getting the user model incorrectly.

    From the docs:

    When you define a foreign key or many-to-many relations to the User model, you should specify the custom model using the AUTH_USER_MODEL setting.

    waffle.compat.User is used to define a ManyToManyField.

    stale 
    opened by izquierdo 12
  • Cleanup and fix management commands.

    Cleanup and fix management commands.

    • Ensure that new switch is not created unless the --create flag is passed.
    • Add tests to ensure no regression for the --create fix on all commands.
    • Add separate positional arguments for commands (instead of "positionals") to improve the --help documentation.
    opened by villiers-s 11
  • Call for Maintainer Help

    Call for Maintainer Help

    To answer @clintonb's question in #245—perhaps it's already obvious—this project has not been high on my list lately, due to any number of factors (I don't write a lot of Python day-to-day at the moment, weekends have been nice outside lately, others).

    To keep the project alive will need the support of more maintainers. I love to add two or three folks to GitHub and PyPI who

    1. use Waffle in their day jobs / active projects;
    2. have at least opened a PR, even if I haven't merged it;
    3. want to see Waffle improve, hopefully beyond their immediate needs; and
    4. care about making open source a welcoming and inclusive space.

    If you'd like to help out (I suspect a couple of folks from #245, #243, #241, #226 and other recent issues might be willing, but don't want to assume) please comment here or email me, and let me know your PyPI username.

    opened by jsocol 11
  • Add Django 1.10.x test environment and fix broken tests

    Add Django 1.10.x test environment and fix broken tests

    Hi James,

    Just a small one here to get the project's test suite up to current speed.

    Tox now runs the test suite successfully under the latest Django 1.10.x and Python 3.6 environments.

    As part of making the tests run under the new environement, the tests were updated to account for deprecated behaviour in Django. Only thing of note really is that render_to_response was removed in favour of render as render_to_response is 'likely pending deprecation' as of Django 1.10.

    Thanks for all your work on this, we use it extensively at Yunojuno. If the 1.10 stuff could get a release on PyPI that'd be super; if there's anything blocking that just let us know.

    Fixes #224.

    cheers, Darian

    opened by djm 11
  • Spaces in Flag/Switch/Sample's fail when using Memcache

    Spaces in Flag/Switch/Sample's fail when using Memcache

    If you're using Memcache as your cache backend and have a space in your Flag, Switch or Sample name memcache throws and error on saving. MemcachedKeyCharacterError: Control characters not allowed

    This is because with Memcache you can't have spaces in the key.

    opened by silent1mezzo 11
  • Allow to overwrite the template tag's name to avoid conflicts.

    Allow to overwrite the template tag's name to avoid conflicts.

    Avoid conflicts with other tags for example the switch/case template tag.

    This can be done by defining WAFFLE_FLAG_TAG_NAME, WAFFLE_SWITCH_TAG_NAME and/or WAFFLE_SAMPLE_TAG_NAME in the settings.py. This is all optional.

    opened by philippeowagner 10
  • Optionally create missing Flags, Samples and Switches

    Optionally create missing Flags, Samples and Switches

    Flags, Switches and Samples may be scattered throughout templates, backend code or across mulitple frontend clients. This patch provides a user with the option of having waffle create a missing Flag, Sample or Switch when one is requested but does not exist.

    The goal of this change is to save operators time by removing the need to search through code for flag/switch/sample names and to reduce communication requirements accross teams with of multiple developers with multiple environments that might require the creation of a flag/switch/sample in the database of every environment code is run in.

    Behavior Changes

    Old Behavior

    1. Flag/Switch/Sample is requested 2a. If found in db evaulate what the value should be for request 2b. If missing return (FLAG|SWITCH|SAMPLE)_DEFAULT value

    New Behavior

    1. Flag/Switch/Sample is requested 2a. If found in db evaulate what the value should be for request 2b. Create Flag/Switch/Sample with value (FLAG|SWITCH|SAMPLE)_DEFAULT
    2. Return (FLAG|SWITCH|SAMPLE)_DEFAULT for this request, subsequent requests will be served using the value from the cache/db

    Further Discussion

    • #44 (https://github.com/jsocol/django-waffle/issues/44)
    • #50 (https://github.com/jsocol/django-waffle/issues/50)

    Future Work

    This change intentionally narrowly scoped and as such does not provide a mechanism to set a default value other than (FLAG|SWITCH|SAMPLE)_DEFAULT for individual objects that are not in the database although it could be expanded in the future to do so.

    opened by adamhaney 9
  • Consolidate config settings for handling missing entities

    Consolidate config settings for handling missing entities

    The problem

    I ran into an error that occured due to a typo in the name of a waffle flag in my code. It would have been much better (IMO), and the bug would have been picked up much earlier, had flat_is_active failed hard for non-existent flags. Failing silently can be dangerous, and whilst I appreciate I can set WAFFLE_LOG_MISSING_FLAGS to logging.ERROR to increase visibility, this will still not cause a request to fail hard. In development environments, I tend not to pay particular attention to logs unless I'm specifically looking for something. However, a hard failure would pick up the typo before it makes it way to production.

    Is this configuration bloat??

    Obviously, not everyone would want the behaviour I suggest above (quite apart from the fact that it would be a breaking change). As such, an extra configuration setting such as WAFFLE_RAISE_MISSING_FLAGS would be needed. There are currently quite a lot of configuration settings for waffle. For each of FLAG, SWITCH and SAMPLE we have:

    • WAFFLE_*_DEFAULT
    • WAFFLE_CREATE_MISSING_*S
    • WAFFLE_LOG_MISSING_*S

    With this in mind, we probably do not want an extra configuration setting. There are no doubt other behaviours that other uses would wish for in the case of a missing flag, and it's untenable to provide a new setting for each of them.

    A proposed solution

    Instead of introducing a new config setting, I propose that we replace WAFFLE_CREATE_MISSING_*S and WAFFLE_LOG_MISSING_*S with a new setting WAFFLE_HANDLE_MISSING_*S which would be a string that points to a function that would be called when an entity is missing. For example:

    # settings.py
    WAFFLE_HANDLE_MISSING_FLAGS = "some_file.handle_missing_flags"
    
    # some_file.py
    def handle_missing_flags(name):
        # potentially log a message, create a flag and do anything else you want
        # optionally return a flag
    

    (If a flag is returned the flag would be cached, and the value from the flag would be used, otherwise the default value would be used - as is the current behaviour).

    This would have several advantages.

    • The default function would use the existing WAFFLE_CREATE_MISSING_*S and WAFFLE_LOG_MISSING_*S settings so that introducing the setting would result in no change in behaviour.
    • We can then utilise the django checks framework to provide warnings that the old settings will eventually be deprecated, and in time update those warnings to errors. Suitable documentation could also be provided to guide migration to the new system (although this should be reasonably straight-forward). This will mean a pleasant deprecation timeline.
    • This allows users greater flexibility to provide the individual functionality they want.
    • This actually reduces the number of configuration settings whilst protecting against future settings bloat.

    (Part of me would like to subsume WAFFLE_*_DEFAULT into the new setting too, but seeing as the default values are used in WaffleJS this would be difficult.)

    If there is support for this proposition I would be more than happy to submit a PR. I look forward to any feedback on the above.

    opened by tim-mccurrach 0
  • feat: Allow override_flag testutil to set different checks

    feat: Allow override_flag testutil to set different checks

    Up until now, the override_flag test util was only useful to completely activate or deactivate a flag. It didn't allow to provide more customization for all the internal checks it makes, like evaluating if the request user is authenticated or staff.

    This change provides that functionality, without breaking the current API, to avoid breaking changes. Now, users can provide more granular arguments to override_flag, for a more flexible flag testing.

    Closes #439.

    opened by adamantike 0
  • TypeError: is_active() got an unexpected keyword argument 'read_only'

    TypeError: is_active() got an unexpected keyword argument 'read_only'

    I am upgrading from django-waffle==0.19.0 to current django-waffle on Django 3.1. I am getting the above TypeError which seems to be related to the changes made in #447. Are there any hints on how to modify existing code the deal with the read_only change?

    opened by cclauss 1
  • `WAFFLE_SWITCH_MODEL` is missing from the

    `WAFFLE_SWITCH_MODEL` is missing from the "Configuring Waffle" docs page

    The setting WAFFLE_SWITCH_MODEL allows using a custom switch model. It's documented on the Switches page but not on the Configuring Waffle page. For comparison, the equivalent setting for flags, WAFFLE_FLAG_MODEL, is documented on both the Flags and Configuring Waffle pages.

    Perhaps there are other settings missing from the Configuring Waffle page? I haven't checked.

    opened by allanlewis 2
  • Enable pytest support for django waffle

    Enable pytest support for django waffle

    It would be very useful if testing utils such as override_switch and override_flag were available for pytest style classes as class decorators. Is this feature somewhere on the road map?

    opened by rievva-aleksandra 3
  • New view to expose flag state as JSON

    New view to expose flag state as JSON

    Waffle currently has a view to expose flag state as Javascript via the WaffleJS endpoint.

    But there are a number of use cases, e.g. backend API calls, where it would be preferable to expose that state in a serialized format like JSON.

    For use cases like an audit dashboard, the view might also expose metadata such as the total number of active and and inactive flags of each type, and the number of stale flags (i.e. more than X days since last toggled).

    I propose a new backend function that queries the database and returns this data, and a new endpoint that returns the data as JSON.

    opened by shaungallagher 3
Releases(v3.0.0)
  • v3.0.0(Aug 30, 2022)

    What's Changed

    • Update Github actions by @ulgens in https://github.com/django-waffle/django-waffle/pull/459
    • Pluggable Switch and Sample models #456 by @cole-jacobs in https://github.com/django-waffle/django-waffle/pull/457
    • Remove support for EOL Python versions by @ulgens in https://github.com/django-waffle/django-waffle/pull/460
    • Update Django versions by @ulgens in https://github.com/django-waffle/django-waffle/pull/461

    New Contributors

    • @ulgens made their first contribution in https://github.com/django-waffle/django-waffle/pull/459
    • @cole-jacobs made their first contribution in https://github.com/django-waffle/django-waffle/pull/457

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.7.0...v3.0.0

    Source code(tar.gz)
    Source code(zip)
  • v2.7.0(Aug 22, 2022)

    What's Changed

    • Expose JSON endpoint for Waffle flag/switch/sample state by @shaungallagher in https://github.com/django-waffle/django-waffle/pull/452

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.6.0...v2.7.0

    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(Jul 20, 2022)

    What's Changed

    • Fixed Django 4.0 compatibility by @triopter in https://github.com/django-waffle/django-waffle/pull/446
    • Added support for custom Sample and Switch models by @shaungallagher in https://github.com/django-waffle/django-waffle/pull/448
    • Added ability to determine if flag is active without persisting new state by @triopter in https://github.com/django-waffle/django-waffle/pull/447
    • Added support for Python 3.10 by @clintonb in https://github.com/django-waffle/django-waffle/pull/450

    New Contributors

    • @triopter made their first contribution in https://github.com/django-waffle/django-waffle/pull/446
    • @shaungallagher made their first contribution in https://github.com/django-waffle/django-waffle/pull/448

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.5.0...v2.6.0

    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Jun 5, 2022)

    What's Changed

    • fix wording error by @simonkern in https://github.com/django-waffle/django-waffle/pull/440
    • Add config to support disabling admin pages by default. by @onurhunce-planetly in https://github.com/django-waffle/django-waffle/pull/444

    New Contributors

    • @onurhunce-planetly made their first contribution in https://github.com/django-waffle/django-waffle/pull/444

    Full Changelog: https://github.com/django-waffle/django-waffle/compare/v2.4.1...v2.5.0

    Source code(tar.gz)
    Source code(zip)
  • v2.4.1(Mar 28, 2022)

  • v2.4.0(Mar 28, 2022)

    • Preventing exceptions for template use cases where a request is not available
    • Creating missing flags for all attempts to access the missing flag
    • Added Italian translations
    • Removed universal wheel
    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Jan 10, 2022)

  • v2.2.1(Jul 13, 2021)

  • v2.2.0(May 21, 2021)

  • v2.1.0(Jan 22, 2021)

  • v2.0.0(Sep 3, 2020)

  • v1.0.0(Jun 22, 2020)

  • v0.20.0(Feb 15, 2020)

  • v0.19.0(Jan 9, 2020)

    • Dropped support for Django 2.0 and 2.1, and Python 3.4
    • Made tests for Jinja2 optional while waiting for django-jinja to be compatible with Django 3.0.
    • Add support for Django 3.0 by removing use of deprecated functionality from Django 2.2.
    Source code(tar.gz)
    Source code(zip)
  • v0.18.0(Nov 3, 2019)

    • Updated MIDDLEWARE setting name for Django 1.10+
    • Improved cache performance for is_active_for_user
    • Corrected log formatting
    • Added log entries for admin quick link actions
    • Added permissions for admin actions
    Source code(tar.gz)
    Source code(zip)
  • v0.17.0(Jul 1, 2019)

  • v0.16.0(Apr 4, 2019)

    • Added support for Django 2.1 and 2.2
    • Flushing cache after modifying flags' groups and users
    • Removed redundant log line
    • Corrected version in waffle/__init__.py
    • Fixed bug in tests
    • Using strings as cache keys instead of bytes
    • Passing effects of test decorator to child classes
      • NOTE: This introduced a backwards-incompatible change for the testutils override decorators. See https://github.com/django-waffle/django-waffle/pull/331 for details.
    Source code(tar.gz)
    Source code(zip)
  • v0.15.1(Jan 9, 2019)

    • Optionally logging missing flags, samples, and switches
    • Added --users option to waffle_flag management command
    • Updated testutils to flush caches
    • Improved admin site for users and groups
    • Fixed global cache thread safety issues
    Source code(tar.gz)
    Source code(zip)
  • v0.15.0(Nov 5, 2018)

    • Dropped support for Django < 1.11
    • Dropped support for Python 3.3
    • Added settings WAFFLE_CREATE_MISSING_(FLAG|SWITCHES|SAMPLES) to optionally create missing objects in the database automatically
    • Allow serializing/de-serializing waffle models by natural key
    • Added pluggable Flag model
    Source code(tar.gz)
    Source code(zip)
  • v0.14.0(Mar 6, 2018)

  • v0.13.0(Jan 24, 2018)

    • Added support for Django 2.0.
    • Added support for search the name and notes fields in Django admin.
    • Fixed small bugs in management commands.
    • Fixed small documentation issues.
    • Updated waffle_flag management command to accept user groups.
    • Added setting WAFFLE_READ_FROM_WRITE_DB to read from write DB on cache miss.
    Source code(tar.gz)
    Source code(zip)
  • v0.12.0a1(May 30, 2016)

    This alpha contains a little more than half of the changes expected to go into 0.12, but it does not contain the settings/API changes from #182.

    Definitely looking for feedback on this version, especially with the caching changes from #211. Those look to significantly simplify how caching works, and will have the most noticeable performance improvements while using wafflejs (see #77, #170).

    To install, you can use pip:

    pip install https://github.com/jsocol/django-waffle/archive/v0.12.0a1.zip
    

    Please file issues and mention this version.

    Source code(tar.gz)
    Source code(zip)
Set the draft security HTTP header Permissions-Policy (previously Feature-Policy) on your Django app.

django-permissions-policy Set the draft security HTTP header Permissions-Policy (previously Feature-Policy) on your Django app. Requirements Python 3.

Adam Johnson 78 Jan 2, 2023
Meta package to combine turbo-django and stimulus-django

Hotwire + Django This repository aims to help you integrate Hotwire with Django ?? Inspiration might be taken from @hotwired/hotwire-rails. We are sti

Hotwire for Django 31 Aug 9, 2022
django-reversion is an extension to the Django web framework that provides version control for model instances.

django-reversion django-reversion is an extension to the Django web framework that provides version control for model instances. Requirements Python 3

Dave Hall 2.8k Jan 2, 2023
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.

Django-environ django-environ allows you to use Twelve-factor methodology to configure your Django application with environment variables. import envi

Daniele Faraglia 2.7k Jan 7, 2023
Rosetta is a Django application that eases the translation process of your Django projects

Rosetta Rosetta is a Django application that facilitates the translation process of your Django projects. Because it doesn't export any models, Rosett

Marco Bonetti 909 Dec 26, 2022
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Feldroy 10k Dec 31, 2022
Django project starter on steroids: quickly create a Django app AND generate source code for data models + REST/GraphQL APIs (the generated code is auto-linted and has 100% test coverage).

Create Django App ?? We're a Django project starter on steroids! One-line command to create a Django app with all the dependencies auto-installed AND

imagine.ai 68 Oct 19, 2022
django-quill-editor makes Quill.js easy to use on Django Forms and admin sites

django-quill-editor django-quill-editor makes Quill.js easy to use on Django Forms and admin sites No configuration required for static files! The ent

lhy 139 Dec 5, 2022
A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, celery and redis.

Django Channels Websocket Chatbot A Django chatbot that is capable of doing math and searching Chinese poet online. Developed with django, channels, c

Yunbo Shi 8 Oct 28, 2022
A handy tool for generating Django-based backend projects without coding. On the other hand, it is a code generator of the Django framework.

Django Sage Painless The django-sage-painless is a valuable package based on Django Web Framework & Django Rest Framework for high-level and rapid web

sageteam 51 Sep 15, 2022
A beginner django project and also my first Django project which involves shortening of a longer URL into a short one using a unique id.

Django-URL-Shortener A beginner django project and also my first Django project which involves shortening of a longer URL into a short one using a uni

Rohini Rao 3 Aug 8, 2021
Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot. A fully Django starter project.

Dockerizing Django with Postgres, Gunicorn, Nginx and Certbot ?? Features A Django stater project with fully basic requirements for a production-ready

null 8 Jun 27, 2022
pytest-django allows you to test your Django project/applications with the pytest testing tool.

pytest-django allows you to test your Django project/applications with the pytest testing tool.

pytest-dev 1.1k Dec 14, 2022
APIs for a Chat app. Written with Django Rest framework and Django channels.

ChatAPI APIs for a Chat app. Written with Django Rest framework and Django channels. The documentation for the http end points can be found here This

Victor Aderibigbe 18 Sep 9, 2022
django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project. Inspired in the dashboard framework Dashing

django-dashing django-dashing is a customisable, modular dashboard application framework for Django to visualize interesting data about your project.

talPor Solutions 703 Dec 22, 2022
Django-MySQL extends Django's built-in MySQL and MariaDB support their specific features not available on other databases.

Django-MySQL The dolphin-pony - proof that cute + cute = double cute. Django-MySQL extends Django's built-in MySQL and MariaDB support their specific

Adam Johnson 504 Jan 4, 2023
Django-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav & ogg), which also makes it easy to play audio files into your Django application.

Django-Audiofield Description: Django Audio Management Tools Maintainer: Areski Contributors: list of contributors Django-Audiofield is a simple app t

Areski Belaid 167 Nov 10, 2022
django Filer is a file management application for django that makes handling of files and images a breeze.

django Filer is a file management application for django that makes handling of files and images a breeze.

django CMS Association 1.6k Jan 6, 2023
Twitter Bootstrap for Django Form - A simple Django template tag to work with Bootstrap

Twitter Bootstrap for Django Form - A simple Django template tag to work with Bootstrap

tzangms 557 Oct 19, 2022