-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor models and save function. Added 'Is Enabled' button and allo…
…wed multiple versions per site. Only the first is used. Added fix for JS Cookies being cleared.
- Loading branch information
carderm
authored and
carderm
committed
Sep 4, 2020
1 parent
4f3c5ff
commit 96c80e9
Showing
10 changed files
with
8,505 additions
and
31 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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
from django.apps import AppConfig | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
class CookieControlConfig(AppConfig): | ||
name = 'django_cookie_control' | ||
verbose_name = 'Django Cookie Control' | ||
verbose_name = _('Django Cookie Control') | ||
|
||
def ready(self): | ||
import django_cookie_control.receivers |
19 changes: 19 additions & 0 deletions
19
django_cookie_control/migrations/0011_auto_20200904_1119.py
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 @@ | ||
# Generated by Django 2.2.16 on 2020-09-04 01:19 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('django_cookie_control', '0010_cookiecontrol_is_enabled'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='cookiecontrol', | ||
name='site', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sites.Site'), | ||
), | ||
] |
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,13 @@ | ||
from django.db.models.signals import post_save | ||
from .models import CookieControl | ||
from .cache import delete | ||
from django.dispatch import receiver | ||
|
||
|
||
@receiver(post_save, sender=CookieControl, dispatch_uid="update_cookie_control_clear_cache") | ||
def clear_cookie_cache(sender, instance, **kwargs): | ||
# Clear the cache | ||
delete(instance.site_id) | ||
|
||
|
||
|
Oops, something went wrong.