Commit 865762bc322fbc9b8459fcca41e0b5a3521d1176
Exists in
master
and in
5 other branches
Merge branch 'master' of https://github.com/amadeusproject/amadeuslms
Showing
2 changed files
with
63 additions
and
8 deletions
Show diff stats
... | ... | @@ -0,0 +1,48 @@ |
1 | +# -*- coding: utf-8 -*- | |
2 | +# Generated by Django 1.9.7 on 2016-09-07 03:38 | |
3 | +from __future__ import unicode_literals | |
4 | + | |
5 | +import datetime | |
6 | +from django.conf import settings | |
7 | +from django.db import migrations, models | |
8 | +import django.db.models.deletion | |
9 | +from django.utils.timezone import utc | |
10 | + | |
11 | + | |
12 | +class Migration(migrations.Migration): | |
13 | + | |
14 | + dependencies = [ | |
15 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
16 | + ('core', '0001_initial'), | |
17 | + ] | |
18 | + | |
19 | + operations = [ | |
20 | + migrations.CreateModel( | |
21 | + name='Log', | |
22 | + fields=[ | |
23 | + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | |
24 | + ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Date and Time of action')), | |
25 | + ('action_resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Action_Resource', verbose_name='Action_Resource')), | |
26 | + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Actor')), | |
27 | + ], | |
28 | + options={ | |
29 | + 'verbose_name_plural': 'Logs', | |
30 | + 'verbose_name': 'Log', | |
31 | + }, | |
32 | + ), | |
33 | + migrations.AlterModelOptions( | |
34 | + name='notification', | |
35 | + options={'verbose_name': 'Notification', 'verbose_name_plural': 'Notifications'}, | |
36 | + ), | |
37 | + migrations.AddField( | |
38 | + model_name='notification', | |
39 | + name='datetime', | |
40 | + field=models.DateTimeField(auto_now_add=True, default=datetime.datetime(2016, 9, 7, 3, 38, 49, 367825, tzinfo=utc), verbose_name='Date and Time of action'), | |
41 | + preserve_default=False, | |
42 | + ), | |
43 | + migrations.AlterField( | |
44 | + model_name='notification', | |
45 | + name='message', | |
46 | + field=models.TextField(verbose_name='Message'), | |
47 | + ), | |
48 | + ] | ... | ... |
core/models.py
... | ... | @@ -3,9 +3,6 @@ from django.utils.translation import ugettext_lazy as _ |
3 | 3 | from users.models import User |
4 | 4 | # Create your models here. |
5 | 5 | |
6 | - | |
7 | - | |
8 | - | |
9 | 6 | class Action(models.Model): |
10 | 7 | """ |
11 | 8 | It represents an Action on the program by a User such as "create post", |
... | ... | @@ -58,14 +55,24 @@ class Action_Resource(models.Model): |
58 | 55 | |
59 | 56 | |
60 | 57 | class Notification(models.Model): |
61 | - message = models.TextField(_('message')) | |
62 | - user = models.ForeignKey(User, verbose_name= _('Actor')) | |
63 | - read = models.BooleanField(_('Read'), default=False) | |
58 | + message = models.TextField(_('Message')) | |
59 | + user = models.ForeignKey(User, verbose_name = _('Actor')) | |
60 | + read = models.BooleanField(_('Read'), default = False) | |
61 | + datetime = models.DateTimeField(_("Date and Time of action"), auto_now_add = True) | |
64 | 62 | action_resource = models.ForeignKey(Action_Resource, verbose_name = _('Action_Resource')) |
65 | 63 | |
66 | 64 | class Meta: |
67 | - verbose_name = "Action_Resource" | |
68 | - verbose_name_plural = "Action_Resources" | |
65 | + verbose_name = _("Notification") | |
66 | + verbose_name_plural = _("Notifications") | |
69 | 67 | |
70 | 68 | def __str__(self): |
71 | 69 | pass |
70 | + | |
71 | +class Log(models.Model): | |
72 | + datetime = models.DateTimeField(_("Date and Time of action"), auto_now_add = True) | |
73 | + user = models.ForeignKey(User, verbose_name = _('Actor')) | |
74 | + action_resource = models.ForeignKey(Action_Resource, verbose_name = _('Action_Resource')) | |
75 | + | |
76 | + class Meta: | |
77 | + verbose_name = _('Log') | |
78 | + verbose_name_plural = _('Logs') | ... | ... |