Commit 08e2195eae0b7229aacfbc07afc33090a825b2b2
1 parent
ae5f663e
Exists in
master
and in
5 other branches
Changing Log model [Issue: #231]
Showing
2 changed files
with
33 additions
and
2 deletions
Show diff stats
@@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
1 | +# -*- coding: utf-8 -*- | ||
2 | +# Generated by Django 1.10 on 2016-11-01 17:57 | ||
3 | +from __future__ import unicode_literals | ||
4 | + | ||
5 | +from django.db import migrations, models | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + ('core', '0002_auto_20161024_1559'), | ||
12 | + ] | ||
13 | + | ||
14 | + operations = [ | ||
15 | + migrations.AddField( | ||
16 | + model_name='log', | ||
17 | + name='component', | ||
18 | + field=models.TextField(default='', verbose_name='Component (Module / App)'), | ||
19 | + preserve_default=False, | ||
20 | + ), | ||
21 | + migrations.AddField( | ||
22 | + model_name='log', | ||
23 | + name='context', | ||
24 | + field=models.TextField(blank=True, verbose_name='Context'), | ||
25 | + ), | ||
26 | + ] |
core/models.py
@@ -101,10 +101,15 @@ class Notification(models.Model): | @@ -101,10 +101,15 @@ class Notification(models.Model): | ||
101 | return self.message | 101 | return self.message |
102 | 102 | ||
103 | class Log(models.Model): | 103 | class Log(models.Model): |
104 | - datetime = models.DateTimeField(_("Date and Time of action"), auto_now_add = True) | ||
105 | - user = models.ForeignKey(User, verbose_name = _('Actor')) | 104 | + component = models.TextField(_('Component (Module / App)')) |
105 | + context = models.TextField(_('Context'), blank = True) | ||
106 | action_resource = models.ForeignKey(Action_Resource, verbose_name = _('Action_Resource')) | 106 | action_resource = models.ForeignKey(Action_Resource, verbose_name = _('Action_Resource')) |
107 | + user = models.ForeignKey(User, verbose_name = _('Actor')) | ||
108 | + datetime = models.DateTimeField(_("Date and Time of action"), auto_now_add = True) | ||
107 | 109 | ||
108 | class Meta: | 110 | class Meta: |
109 | verbose_name = _('Log') | 111 | verbose_name = _('Log') |
110 | verbose_name_plural = _('Logs') | 112 | verbose_name_plural = _('Logs') |
113 | + | ||
114 | + def __str__(self): | ||
115 | + return self.message |