Commit 3b55783d by Gregory Martin

Retire User from RevisionPluginRevision

EDUCATOR-2702
parent a6bd51e4
......@@ -33,5 +33,3 @@ virtualenv
*.swp
.idea/
.idea/vcs.xml
......@@ -2,11 +2,15 @@
import os
from setuptools import setup, find_packages
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
"""
Utility function to read the README file.
Used for the long_description. It's nice, because now 1) we have a top level
README file and 2) it's easier to type in the README file than to put a raw
string in below ...
"""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
......
......@@ -198,8 +198,7 @@ class RevisionPluginRevision(BaseRevisionMixin, models.Model):
not self.previous_revision and
self.plugin and
self.plugin.current_revision and
self.plugin.current_revision != self):
self.plugin.current_revision != self):
self.previous_revision = self.plugin.current_revision
if not self.revision_number:
......@@ -216,6 +215,15 @@ class RevisionPluginRevision(BaseRevisionMixin, models.Model):
self.plugin.current_revision = self
self.plugin.save()
@classmethod
def retire_user(cls, user):
"""
Updates a user record as a part of GDPR Phase II
:param user (obj)
:return: bool
"""
return cls.objects.filter(user=user).update(ip_address='') > 0
class Meta:
get_latest_by = 'revision_number'
ordering = ('-created',)
......@@ -229,6 +237,7 @@ class RevisionPluginRevision(BaseRevisionMixin, models.Model):
# It's my art, when I disguise my body in the shape of a plane.
# (Shellac, 1993)
def update_simple_plugins(instance, *args, **kwargs):
"""Every time a new article revision is created, we update all active
plugins to match this article revision"""
......@@ -237,4 +246,4 @@ def update_simple_plugins(instance, *args, **kwargs):
# TODO: This was breaking things. SimplePlugin doesn't have a revision?
p_revisions.update(article_revision=instance)
signals.post_save.connect(update_simple_plugins, ArticleRevision)
\ No newline at end of file
signals.post_save.connect(update_simple_plugins, ArticleRevision)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment