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)
Django With VueJS Blog App

django-blog-vue-app frontend Project setup yarn install Compiles and hot-reload

Flavien HUGS 2 Feb 04, 2022
Run Django tests with testcontainers.

django-rdtwt (Run Django Tests With Testcontainers) This targets users who wish to forget setting up a database for tests. There's no manually startin

2 Jan 09, 2022
Awesome Django Markdown Editor, supported for Bootstrap & Semantic-UI

martor Martor is a Markdown Editor plugin for Django, supported for Bootstrap & Semantic-UI. Features Live Preview Integrated with Ace Editor Supporte

659 Jan 04, 2023
Simple tagging for django

django-taggit This is a Jazzband project. By contributing you agree to abide by the Contributor Code of Conduct and follow the guidelines. django-tagg

Jazzband 3k Jan 02, 2023
A better and faster multiple selection widget with suggestions

django-searchable-select A better and faster multiple selection widget with suggestions for Django This project is looking for maintainers! Please ope

Andrew Dunai 105 Oct 22, 2022
Sistema de tratamento e análise de grandes volumes de dados através de técnicas de Data Science

Sistema de tratamento e análise de grandes volumes de dados através de técnicas de data science Todos os scripts, gráficos e relatórios de todas as at

Arthur Quintanilha Neto 1 Sep 05, 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 04, 2023
Twitter-clone using Django (DRF) + VueJS

Twitter Clone work in progress 🚧 A Twitter clone project Table Of Contents About the Project Built With Getting Started Running project License Autho

Ahmad Alwi 8 Sep 08, 2022
Basic implementation of Razorpay payment gateway 💳 with Django

Razorpay Payment Integration in Django 💥 In this project Razorpay payment gateway 💳 is integrated with Django by breaking down the whole process int

ScaleReal 12 Dec 12, 2022
Official clone of the Subversion repository.

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. All documentation is in the "docs" directo

Raymond Penners 3 May 06, 2022
pdm-django: Django command shortcuts for PDM

pdm-django: Django command shortcuts for PDM A plugin that gives you command shortcuts for developing with PDM. pdm run python manage.py runserver -

Neutron Sync 2 Aug 11, 2022
Projeto Crud Django and Mongo

Projeto-Crud_Django_and_Mongo Configuração para rodar o projeto Download Project

Samuel Fernandes Oliveira 2 Jan 24, 2022
simple project management tool for educational purposes

Taskcamp This software is used for educational and demonstrative purposes. It's a simple project management tool powered by Django Framework Install B

Ilia Dmitriev 6 Nov 08, 2022
Repo for All the Assignments I have to submit for Internship Application !😅

Challenges Repository for All the Assignments I have to submit for Internship Application ! 😅 As You know, When ever We apply for an Internship, They

keshav Sharma 1 Sep 08, 2022
Domain-driven e-commerce for Django

Domain-driven e-commerce for Django Oscar is an e-commerce framework for Django designed for building domain-driven sites. It is structured such that

Oscar 5.6k Jan 01, 2023
A feature flipper for Django

README Django Waffle is (yet another) feature flipper for Django. You can define the conditions for which a flag should be active, and use it in a num

950 Dec 26, 2022
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
A Django app to accept payments from various payment processors via Pluggable backends.

Django-Merchant Django-Merchant is a django application that enables you to use multiple payment processors from a single API. Gateways Following gate

Agiliq 997 Dec 24, 2022
AUES Student Management System Developed for laboratory works №9 Purpose using Python (Django).

AUES Student Management System (L M S ) AUES Student Management System Developed for laboratory works №9 Purpose using Python (Django). I've created t

ANAS NABIL 2 Dec 06, 2021
A Django/Python web app that functions as a digital diary

My Django Diary Full-stack web application that functions as a digital diary using Django, Python, SQLite, HTML & CSS. Things I learned during this pr

1 Sep 30, 2022