-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5502 from edx/will/per-course-donation-button
Add donation button to the enrollment success message
- Loading branch information
Showing
22 changed files
with
1,101 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Decorators for model-based configuration. """ | ||
from functools import wraps | ||
from django.http import HttpResponseNotFound | ||
|
||
|
||
def require_config(config_model): | ||
"""View decorator that enables/disables a view based on configuration. | ||
Arguments: | ||
config_model (ConfigurationModel subclass): The class of the configuration | ||
model to check. | ||
Returns: | ||
HttpResponse: 404 if the configuration model is disabled, | ||
otherwise returns the response from the decorated view. | ||
""" | ||
def _decorator(func): | ||
@wraps(func) | ||
def _inner(*args, **kwargs): | ||
if not config_model.current().enabled: | ||
return HttpResponseNotFound() | ||
else: | ||
return func(*args, **kwargs) | ||
return _inner | ||
return _decorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.