How to use the impostor.models.ImpostorLog function in Impostor

To help you get started, we’ve selected a few Impostor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github samastur / Impostor / impostor / admin.py View on Github external
# -*- coding: utf-8 -*-

from django.contrib import admin
from django.shortcuts import render

from .models import ImpostorLog


@admin.register(ImpostorLog)
class ImpostorAdmin(admin.ModelAdmin):
    fields = ('impostor', 'imposted_as', 'logged_in', 'impostor_ip')
    list_display = ('impostor', 'imposted_as', 'impostor_ip', 'logged_in', 'logged_out', 'token')
    list_editable = ()
    actions_on_top = False
    actions_on_bottom = False
    ordering = ('-logged_in', 'impostor')
    readonly_fields = ('impostor', 'imposted_as', 'impostor_ip', 'logged_in', 'logged_out', 'token')
    search_fields = ('impostor__username', 'imposted_as__username')

    def add_view(self, request, form_url='', extra_context=None):
        request.method = 'GET'
        return super(ImpostorAdmin, self).add_view(request, form_url, extra_context)

    def change_view(self, request, object_id, form_url='', extra_context=None):
        request.method = 'GET'
github samastur / Impostor / impostor / models.py View on Github external
def save(self, *args, **kwargs):
        """
        Custom save method

        :param args:
        :param kwargs:
        :return:
        """
        if not self.token and self.impostor:
            self.token = str(uuid.uuid4())

        super(ImpostorLog, self).save(*args, **kwargs)