from django.contrib.auth.admin import admin
from django.db import models

# Create your models here.

TYPES = (
    ('login','login'),
    ('insert','insert'),
    ('edit','edit'),
    ('delete','delete'),
)

class Edition(models.Model):
    user = models.EmailField(null=True)
    types = models.CharField(max_length=255,null=True,choices=TYPES)
    obj_model = models.CharField(max_length=255,null=True)
    obj_id = models.CharField(max_length=255,null=True)
    obj_instance = models.CharField(max_length=255,null=True)
    comment = models.CharField(max_length=255,null=True)
    created = models.DateTimeField(auto_now_add=True)

class EditionAdmin(admin.ModelAdmin):
    list_display = ('user','types','obj_model','obj_id','comment','created')
    list_filter = ('user','types')
