forked from revsys/django-tos
-
Notifications
You must be signed in to change notification settings - Fork 0
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 revsys#30 from blag/small-fixups
Small fixups
- Loading branch information
Showing
7 changed files
with
131 additions
and
28 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
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,19 @@ | ||
from django.conf import settings | ||
|
||
from .compat import get_cache | ||
|
||
# Force the user to create a separate cache | ||
cache = get_cache(getattr(settings, 'TOS_CACHE_NAME', 'default')) | ||
|
||
|
||
def invalidate_cached_agreements(TermsOfService, instance, **kwargs): | ||
if kwargs.get('raw', False): | ||
return | ||
|
||
# Set the key version to 0 if it doesn't exist and leave it | ||
# alone if it does | ||
cache.add('django:tos:key_version', 0) | ||
|
||
# This key will be used to version the rest of the TOS keys | ||
# Incrementing it will effectively invalidate all previous keys | ||
cache.incr('django:tos:key_version') |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<h2>Terms of Service as of {{ tos.created|date:"SHORT_DATE_FORMAT" }}</h2> | ||
{% load i18n %} | ||
|
||
{{ tos.content|safe }} | ||
<h2>{% blocktrans %}Terms of Service as of {{ tos.created|date:"SHORT_DATE_FORMAT" }}{% endblocktrans %}</h2> | ||
|
||
{{ tos.content|safe }} |
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 |
---|---|---|
@@ -1,19 +1,20 @@ | ||
{% load i18n %} | ||
{% load url from compat %} | ||
{% if note %} | ||
<h2>{{ note }}</note> | ||
{% else %} | ||
<h2>Terms of Service as of {{ tos.created|date:"SHORT_DATE_FORMAT" }}</h2> | ||
<h2>{% blocktrans %}Terms of Service as of {{ tos.created|date:"SHORT_DATE_FORMAT" }}{% endblocktrans %}</h2> | ||
{% endif %} | ||
|
||
{{ tos.content|safe }} | ||
|
||
<h2>Accept Terms of Service?</h2> | ||
<h2>{% trans "Accept Terms of Service?" %}</h2> | ||
|
||
<form method="post" action="{% url "tos_check_tos" %}"> | ||
{% csrf_token %} | ||
{% if next %} | ||
<input type="hidden" name="next" value="{{next}}"> | ||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ next }}"> | ||
{% endif %} | ||
<input type="submit" name="accept" value="accept"> | ||
<input type="submit" name="accept" value="reject"> | ||
<button type="submit" name="reject" value="reject">{% trans "Reject" %}</button> | ||
<button type="submit" name="accept" value="accept">{% trans "Accept" %}</button> | ||
</form> |
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