Skip to content

Commit

Permalink
refactor(log/mixins.py): remove LogMixin from codebase so we don't ha…
Browse files Browse the repository at this point in the history
…ve a mixin for it anymore #648
  • Loading branch information
fbormann committed Jun 5, 2019
1 parent c05016b commit 6ff052b
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions log/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,3 @@
Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENSE", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
"""

from .models import Log


class LogMixin(object):
log_component = None
log_action = None
log_resource = None

def create_log(self, actor=None, component='', log_action='', log_resource=''):
if actor.is_authenticated:
log = Log()
log.user = str(actor)
log.user_id = actor.id
log.user_email = actor.email

if self.log_component is not None:
log.component = self.log_component
else:
log.component = component

if self.log_action is not None:
log.action = self.log_action
else:
log.action = log_action
if self.log_resource is not None:
log.resource = self.log_resource
else:
log.resource = log_resource

log.save()

def dispatch(self, request, *args, **kwargs):
return super(LogMixin, self).dispatch(request, *args, **kwargs)

0 comments on commit 6ff052b

Please sign in to comment.