A feature flipper for Django

Related tags

Djangodjango-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)
Tweak the form field rendering in templates, not in python-level form definitions. CSS classes and HTML attributes can be altered.

django-widget-tweaks Tweak the form field rendering in templates, not in python-level form definitions. Altering CSS classes and HTML attributes is su

Jazzband 1.8k Jan 02, 2023
Django REST Client API

Django REST Client API Client data provider API.

Ulysses Monteiro 1 Nov 08, 2021
Displaying objects on maps in the Django views and administration site.

DjangoAdminGeomap library The free, open-source DjangoAdminGeomap library is designed to display objects on the map in the Django views and admin site

Vitaly Bogomolov 31 Dec 28, 2022
Django + AWS Elastic Transcoder

Django Elastic Transcoder django-elastic-transcoder is an Django app, let you integrate AWS Elastic Transcoder in Django easily. What is provided in t

StreetVoice 66 Dec 14, 2022
A fresh approach to autocomplete implementations, specially for Django. Status: v3 stable, 2.x.x stable, 1.x.x deprecated. Please DO regularely ping us with your link at #yourlabs IRC channel

Features Python 2.7, 3.4, Django 2.0+ support (Django 1.11 (LTS), is supported until django-autocomplete-light-3.2.10), Django (multiple) choice suppo

YourLabs 1.7k Jan 01, 2023
A pickled object field for Django

django-picklefield About django-picklefield provides an implementation of a pickled object field. Such fields can contain any picklable objects. The i

Gintautas Miliauskas 167 Oct 18, 2022
Django Livre Bank

Django Livre Bank Projeto final da academia Construdelas. API de um banco fictício com clientes, contas e transações. Integrantes da equipe Bárbara Sa

Cecília Costa 3 Dec 22, 2021
django-idom allows Django to integrate with IDOM

django-idom allows Django to integrate with IDOM, a package inspired by ReactJS for creating responsive web interfaces in pure Python.

113 Jan 04, 2023
Automatically deletes old file for FileField and ImageField. It also deletes files on models instance deletion.

Django Cleanup Features The django-cleanup app automatically deletes files for FileField, ImageField and subclasses. When a FileField's value is chang

Ilya Shalyapin 838 Dec 30, 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 09, 2022
Official Python agent for the Elastic APM

elastic-apm -- Elastic APM agent for Python This is the official Python module for Elastic APM. It provides full out-of-the-box support for many of th

elastic 369 Jan 05, 2023
Store model history and view/revert changes from admin site.

django-simple-history django-simple-history stores Django model state on every create/update/delete. This app supports the following combinations of D

Jazzband 1.8k Jan 08, 2023
Median and percentile for Django and MongoEngine

Tailslide Median and percentile for Django and MongoEngine Supports: PostgreSQL SQLite MariaDB MySQL (with an extension) SQL Server MongoDB 🔥 Uses na

Andrew Kane 4 Jan 15, 2022
Developer-friendly asynchrony for Django

Django Channels Channels augments Django to bring WebSocket, long-poll HTTP, task offloading and other async support to your code, using familiar Djan

Django 5.5k Dec 29, 2022
:couple: Multi-user accounts for Django projects

django-organizations Summary Groups and multi-user account management Author Ben Lopatin (http://benlopatin.com / https://wellfire.co) Status Separate

Ben Lopatin 1.1k Jan 01, 2023
Drf-stripe-subscription - An out-of-box Django REST framework solution for payment and subscription management using Stripe

Drf-stripe-subscription - An out-of-box Django REST framework solution for payment and subscription management using Stripe

Oscar Y Chen 68 Jan 07, 2023
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

8 Jun 27, 2022
Website desenvolvido em Django para gerenciamento e upload de arquivos (.pdf).

Website para Gerenciamento de Arquivos Features Esta é uma aplicação full stack web construída para desenvolver habilidades com o framework Django. O

Alinne Grazielle 8 Sep 22, 2022
Use minify-html, the extremely fast HTML + JS + CSS minifier, with Django.

django-minify-html Use minify-html, the extremely fast HTML + JS + CSS minifier, with Django. Requirements Python 3.8 to 3.10 supported. Django 2.2 to

Adam Johnson 60 Dec 28, 2022
Django web apps for managing schedules.

skdue Description Skdue is a web application that makes your life easier by helping you manage your schedule. With the ability which allows you to cre

Patkamon_Awai 1 Jun 30, 2022