Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Allow switches to be be bound to sites #74

Open
kitsunde opened this issue May 10, 2016 · 4 comments
Open

Allow switches to be be bound to sites #74

kitsunde opened this issue May 10, 2016 · 4 comments

Comments

@kitsunde
Copy link

We have several multi-tennant sites and currently we're doing something pretty awkward with waffle where we postfix the site like (feature_video_sg, feature_video_nz) and then do an awkward lookup.

@adamchainz
Copy link
Owner

What about a site condition, where you turn a switch on only for specific sites?

@adamchainz adamchainz changed the title Could allow for sites to be bound to switches? Allow switches to be be bound to sites May 10, 2016
@adamchainz
Copy link
Owner

Also I presume you're talking about Django's Site framework

@kitsunde
Copy link
Author

Yeah we're using the standard Django Site framework. Ideally we would bind the switches m2m to the sites.Site model.

@adamchainz
Copy link
Owner

You should be able to create a ConditionSet based on RequestConditionSet that does this.

See IPAddressConditionSet for a sample implementation that looks at the IP of the request - you could easily adapt it to look at request.get_current_site(). IPAddressConditionSetTests are also a pretty good guide on how to test.

If you start and open a PR I'll help with code review and completing anything that turns out to be difficult. Of course you can implement it in your own project's code base right now if you need it right now :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants